Sunday, 18 August 2013

Regex to extract lines after the last occurence

Regex to extract lines after the last occurence

Hi I have a paragraph like this :
output 123
Deepak everywhere
Deepak where are
output 123
Ankur Everywhere
Deepak where are
last
Deepak everywhere
Deepak where are
I want to extract after last occurrence of "output 123" to "last" . This
is what I expect :
Ankur Everywhere
Deepak where are
last
I use this RegEx pattern - (?<=(output))([^\\n]*)last . But using this,
what I get is :
output 123
Deepak everywhere
Deepak where are
output 123
Ankur Everywhere
Deepak where are
last
Can anyone help ? I use this tool - http://regexr.com?360e5

No comments:

Post a Comment