My text is:
120 something 130 somethingElse Paris
My goal is to capture 130 somethingElse Paris
which means only the last occurrence of number BEFORE Paris
I tried:
\d+.*Paris
But this captures the WHOLE string (from first occurrence of digit)
The rule is:
- Capture everything before
Paris
until first occurrence of digit is found.
Any clue ?
regards
You can use this pattern:
other occurences of the capturing group are overwritten by the last.
The lazy quantifier
*?
is used to force the pattern to stop at the first word "Paris". Otherwise, in a string with more than one word "Paris", the pattern will return the last group after the last word "Paris" with a greedy quantifier.