Regex to find the 2nd occurance

Maybe this is simple.

Input: “Total 3,12 4,35 6,84”

I want my match to be 4,35.

Challenge: The number is random, so next time it will e.g. be 4,35.
Challenge: The number of spaces between the numbers differ from time to time

Hi @LauraMM

I could not understand ur query well

Can u elaborate please

Hello

I think I understand your scenario.

Try this pattern:
(?<=Total\s+\d+,\d+\s+)\d+,\d+

It will match the second pair (eg 4,56) of digits regardless of length of spaces between digits or length of digits.

Hopefully this helps :blush:

If you want to Learn Regex - check out my Regex MegaPost

2 Likes

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