I am trying to use regex to match a file in the following format:
FILTER <data> ORDER <data>
Now the <data> is the one I need to extract, and that would be very simple, except that I had the following complications:
1) This pattern can be repeated (not a single line is torn between them)
2) <data> may not be there.
In particular, this file is in order:
FILTER test1 ORDER test2 FILTER test3 ORDER FILTER ORDER
And should give me the following groups:
"test1", "test2", "test3", "," "," "
I have already tried the regex: (?:FILTER\n(.*)\nORDER\n(.*))*
Here is a test for regex101.
I am new to regex, any help would be appreciated.
source share