I have tried:
preg_match("/^[a-zA-Z0-9]", $value)
but im doing something wrong i guess.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Use PHP’s inbuilt ctype_alnum
You dont need to use a regex for this, PHP has an inbuilt function
ctype_alnumwhich will do this for you, and execute faster:2. Alternatively, use a regex
If you desperately want to use a regex, you have a few options.
Firstly:
\wincludes more than alphanumeric (it includes underscore), but includes allof
\d.Alternatively:
Or even just: