jeudi 1 novembre 2018

Regex with decimal number that must be specific number

I need a regex for numbers like those

+2.25
-9,75
+02,50
-10.00

What I have done so far is this ^([-+]\d{2}[.,][00|25|50|75]{1,2})$

1- [-+] = obligatory at the beginning
2- \d{2} = any number between 0 and 99
3- [.,] = separator can be .or,
4- [00|25|50|75]{1,2} = input must be 00 or 25 or 50 or 75

The number 4- is not working as you can test here https://regex101.com/.

Aucun commentaire:

Enregistrer un commentaire