How can I display a list of characters that fail to match a regular expression?
Posted
by Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-03-19T07:24:24Z
Indexed on
2010/03/19
7:31 UTC
Read the original article
Hit count: 238
For example, if I'm doing some form input validation and I'm using the following code for the name
field.
preg_match("/^[a-zA-Z .-]$/", $firstname);
If someone types in Mr. (Awkward) Double-Barrelled
I want to be able to display a message saying Invalid character(s): (, )
© Stack Overflow or respective owner