I have few lines of data in a multi line string where few lines are overlapping , But I wanted to match the longest line . Below is the sample data . Is there any regex for this ?
This is one two OK.
This is one two OK one three OK.
This is one two OK one three OK one four OK.
This is one two OK one three OK one four OK one five OK
...
The O/P should now be
This is one two OK one three OK one four OK one five OK.
If I use quantifiers , it matches all the lines . The input starts from This and ends with OK , But it should match only the longest one . Please suggest me .