Select all text between to words

I need help to get a regex solution to select text between two words

Food:
2000 Apple, Banana,
Chicken

Color
1 Blue
2 Red
3 Yellow
4 Green
5 Purple

Country

My question is

How will the regex soultion look to get all the text between Food and Color

And the text between Color and Country.

I want all the text between, not the word Food, Color and Country.

Try this:

(?<=Food:\s)[\s\S]*?(?=Color)

https://regex101.com/r/4apcA9/1

3 Likes

Thank you!

1 Like

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