Grab Text Before Word but also exclude top line using regex

Hello, Can someone help with with a regex to capture the text above the word “OR”? However, I also do not want the top line. Here is an example:

What to do in the morning:

  1. Get out of Bed
  2. Stay in bed

I want to capture 1) Get out of Bed. But I do not want “What to do in the morning”

Please see if the sentence you’re looking for is always right behind OR

It is always behind OR on a new line which is above

@Asanka Check the regex in the link :
Try it for all possible data that you have, if it doesn’t work for some data, post a sample of that data, so that we can try to give you a more robust solution.

1 Like


Check as below

Mark as solution if this helps



This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.