RE: [PHP] Allowing punctuation marks in regular expressions
| From: | Dan Joseph | Date: | Thu, 05 Jun 2003 19:41:49 +0000 |
| Subject: | RE: [PHP] Allowing punctuation marks in regular expressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150396@lists.php.net to get a copy of this message | ||
Hi,
> return (preg_match("/^[a-z0-9]+$/i", $string));
That a-z0-9 is where you can do it. Just add ! or . or ? to the end:
a-z0-9!?.
Also, if you want upper case letters, make sure you add A-Z:
A-Za-z0-9!?.
-Dan Joseph