I want to search for string that occurs between a certain string. For example,
\start
\problem{number}
\subproblem{number}
/* strings that I want to get */
\subproblem{number}
/* strings that I want to get */
\problem{number}
\subproblem{number}
...
...
\end
More specifically, I want to get problem number and subproblem number and strings between which is answer.
I somewhat came up with expression like
'(\\problem{(.*?)}\n)? \\subproblem{(.*?)} (.*?) (\\problem|\\subproblem|\\end)'
but it seems like it doesn’t work as I expect. What is wrong with this expression?
This one:
returns three matches for me:
Match 1:
Match 2:
Match 3:
However I’d rather parse it in two steps.
First find the problem’s number (group 1) and content (group 2) using:
Then find the subproblem’s numbers (group 1) and contents (group 2) inside that content using: