Saturday, 15 May 2010

php - regex for any alphanumeric characters except the number 0 -



php - regex for any alphanumeric characters except the number 0 -

for non-zero have /^[1-9][0-9]*$/, , alphanumeric ^[0-9a-za-z ]+$, don't know how combine these.

please help regex alphanumeric pattern except single 0

you can utilize pattern prevent matches starting 0

^(?!0)[0-9a-za-z ]+$

if 01 ok not 0 utilize pattern

^(?!0$)[0-9a-za-z ]+$

php regex

No comments:

Post a Comment