I want to use preg_match()
such that there should not be special characters such as @#$%^&/ '
in a given string.
For example :
Coding
: Outputs valid
: Outputs Invalid (string beginning with space)Project management
: Outputs valid (space between two words are valid)Design23
: Outputs valid23Designing
: Outputs invalid123
:Outputs invalidI tried but could not reach to a valid answer.
Try
'/^[a-zA-Z][\w ]+$/'