I am trying to match a group of words between two words in a String. I will be using Java RegEx.
Input Text
The clever fox JUMPED OVER the big dog and ran away.
Expected Output
the big
RegEx Used
(?<=(fox\s[A-Z0-9]*))(?s)(.*?)(?=\sdog)
I get below output which gives me all words between fox and dog
JUMPED OVER the big
The word "fox" will be followed by one or more all upper case words always. I need to match all the words following these two words till I get "dog".
Also I need to get the desired output in Capture Group 0. I can not use different capture groups. This is a limitation in my application.
Any help on this is greatly appreciated.