Regex that finds both integers, decimals, and thousands separators

43 Views Asked by At

I want to find a regex that matches all the following strings:

-5,84;;EUR
2.764,90;EUR
-47;;EUR

This regex -?\d+\,?\d+;{1,2}\s*EUR doesn't find the 2. in 2.764,90;EUR, whereas this one -?\d+?[.]\d+\,?\d+;{1,2}\s*EUR only finds the 2.764,90;EUR.

1

There are 1 best solutions below

2
Gilles Quénot On BEST ANSWER

Try:

-?[\d.]+(?:\,\d+)?;{1,2}\s*EUR

Regex Demo