regex - Regular Expression (PHP) => greater that or if not -
it possible have in regular expression (php), '>' or 'if not' ¿?
for example: have 5 number string 'xxxxx': '00054', '47690', '20593'...
i need regular expression verify:
- 5 numbers
- greater 1
i had this: '/^[0-9]{5}$/' doesn't verify greater '00001' !
i'm looking '>' or 'if not 00000'...
thanks
ps: know can done with: if((int)$string > 1)
i can figure out 2 ways:
/^(?!00000)\d{5}$/
this first checks start not followed 5 zeros, searches 5 digits.
/^(?:[1-9]\d{4}|\d[1-9]\d{3}|\d{2}[1-9]\d{2}|\d{3}[1-9]\d|\d{4}[1-9])$/
this 1 checks 5 combinations, each of contains non-zero digit in 1 of 5 positions.
Comments
Post a Comment