Psychotomus1
Oct 2nd 2007, 10:17 pm
how can I check if a string is a-Z 0-9 and the - symbol.
kendo1979
Oct 2nd 2007, 10:56 pm
use preg_match
preg_match ( string pattern, string subject [, array &matches [, int flags [, int offset]]] )
krt
Oct 2nd 2007, 11:32 pm
The pattern you need is /^[a-z0-9-]+$/i or you can do the opposite:
if (!preg_match("/[^a-z0-9-]/", ...
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.