DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
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 ?

Oldest comments (0)

πŸ€” Did you know?

✍️ Writing your own article is easy (we even support markdown)