Regular Expressions 101

Community Patterns

Community Library Entry

6

Regular Expression
PCRE (PHP <7.3)

/
^\s*?([\d\.]+(\,\d{1,2})?|\,\d{1,2})\s*$
/

Description

Hi, I am trying to get a reg ex that will test a number range and also allow european number convention like , for decimal point. I have this one for range check - ^([4-9][0-9]{3}|[1-9][0-9]{4,5}|[12][0-9]{6}|3[0-4][0-9]{5}|3500000)$ and I have this one for allow comma ^\s*?([\d.]+(,\d{1,2})?|,\d{1,2})\s*$ but I need a combination of both, Thanks if you can help

Submitted by TimJ - 10 years ago