
Let’s start with this initial text data, below, where I, intentionally, added additional line-breaks, in a random order, and removed some others, in order to simulate a general format : This a first test! The correct letter is preceded by the string ANSWER, in uppercase, immediately followed by a colon and a space characters OK, Alan, So here is my regex solution, ( already written ! )Įach possible answer begins with an uppercase letter, immediately followed by a dot and a space characters Now although I have stated 3 steps, in fact each one has a few steps within, however the option is there should you wish to pursue that idea. The next few lines would be the multiple answers, followed by a blank line. Change the lines back to the original format with question first.Have each question and multiple answers appear on 1 line, with the question first.Ģ.Insert an incrementing number at the start of the line and if necessary move it to the correct position.Using the examples I gathered from your link I ran up 10 questions. It is certainly possible (at least in my limited testing).

As the others stated, it would be better using a scripting/programming language however that then involves additional learning, something that might not produce a result quickly. As a test I decided to see what’s involved in doing this via a regular expression.

This numbers each question in the Aiken file. Said in Replace text with incremented counter:
