regex for currency (euro)

前端 未结 3 1680
鱼传尺愫
鱼传尺愫 2020-12-20 07:20

i am trying this code for make a validation for a value. (regex from this site)

UPDATE:

Now i have

$value1=250;    

$value2=10000;

                 


        
3条回答
  •  余生分开走
    2020-12-20 08:05

    The regex solution would look like this

    ^(?:10000|(?:(?:(?:2[5-9]\d)|[3-9]\d{2}|\d{4})(?:[,.]\d{2})?))€?$
    

    See here online on Regexr

    But it would be better for checking if a value belongs to a range, not to use a regex. You can extract the value easily and do a normal <> check on numbers outside.

提交回复
热议问题