I am attempting to format a series of test questions for implementation to an online course in LibreOffice Writer. The test question format was changed recently and I have to update all 500+ questions in a text file before implementation.
The questions currently look like this:
1. alter verb (awl-ter)
to change; become different or modified
■Example: The design of the king’s suit was altered to suit his taste.
□Note: Can be confused with altar , alter.
we need to change the format to look like this:
Word: alter verb (awl-ter)
Definition: to change, become different or modified
Example: The design of the king’s suit was altered to suit his taste.
Possible Exam Question: Can be confused with altar , alter.
I know enough regex to be able to format most of the lines automatically, with the exception of the definition line. I specifically need to add the word "Definition:" to the beginning of the line immediately after the "Word" line, but I cannot seem to figure out how to do this properly.
I have tried using (\b\d+\.\s\w.*[\r\n])
which can find the first line of each definition group (as shown above), and up to the new line / return - however, when attempting to append the text using $1Definition:
which according to Writer's regex help file should keep the original findings and append whatever is after the "$1", it will either replace once and never work again with subsequent "replace" clicks, or will replace everything with a literal string of $1Definition:
if using the "replace all" button...
I've added a screencap of the search function highlighting the string. The search does seem to find what I'm looking for and will highlight the first line of each set when clicking "find all".
The problem comes to fruition (as mentioned above) when attempting to click "replace" more than once or click "replace all".
I'm currently at a loss as to what the problem is / how to fix this. It almost seems like my Regex is somehow corrupting the search query and output.