can someone show me the regex for this preg_match. I want to make sure first letter in string is nothing but a letter, either uppercase or lowercase. thanks. I found this, but it doesnt seem to be working.
var_dump(preg_match("^/[A-Za-z]+/", $search_terms ));
The line above returns false, ever开发者_开发问答y time.
"^/[A-Za-z]+/"
should be "/^[A-Za-z]+/"
What about something like this, for your regex :
/^[A-Za-z]/
- Begins with :
^
- One character that is a letter :
[A-Za-z]
The ^
symbol should be at the beginning of the regex, but inside its delimiters ;-)
精彩评论