note 78417 deleted from function.preg-match by felipe
| From: | felipe@php.net | Date: | Sun, 23 Mar 2008 22:55:42 +0000 |
| Subject: | note 78417 deleted from function.preg-match by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137374@lists.php.net to get a copy of this message | ||
Note Submitter: erandra at gmail dot com
----
Here is a sample code to check for alphabetic characters only with an exception to space, hyphen and
single quotes using preg_match().
$alpha = "some very funny string'9-2'";
/* check for alphabets and hyphens, quotes and space in the string but no numbers */
if(preg_match("/^[a-zA-Z\-\'\ ]+$/u", $alpha)){
return 1;
}else
return 0;
one can just add a '\' followed by the character he wish to allow for use [\@].
i hope it would be helpful to some one their.
-Erandra