phpregexvalidationpreg-matchcpu-word

Validate that a string contains only space-delimited alphanumeric words which do not start with a digit


I want to use preg_match() such that there should not be special characters such as @#$%^&/ ' in a given string.

For example :

I tried but could not reach to a valid answer.


Solution

  • Try

    '/^[a-zA-Z][\w ]+$/'