DEV Community

MANOHARA  M
MANOHARA M

Posted on

Need to extract text between two words that last occurred

I am using (?s)(?<=Observation Description:\s).*?(?=Attachment) to get the text between “Observation Description:” and “Attachment” words.

I am able to do it with above expression. The word ‘Observation Description’ appears at many places. I want to extract the text between last occurrence of “Observation Description” and next first “Attachment”.

Can you help me how can I do it ?

Top comments (0)