I am trying to extract some useful data from a large chunck of data given through regex.
Sample string:
test 1:
hello op1 yviphf
hello op2 vipqwe
test 2:
hello op3
hello op4 vipgt
hello op5 zcv
Above contains 2 test numbers but there are several. I want to extract op1, op2, op3, op4, op5 and also the corresponding test numbers. The number of op's in each test can vary.
Below is the pattern I tried writing but it does not help:
test\s(\d+).*?(?:hello\s+(\S+).*?\n)+
The output could be list of list. The main list would have the first element as the test number and the second element might be the list containing all the op's.
/sflag? See regex101.com/r/nU8aA5/1