note 32149 added to ref.pcre
| From: | mrPuta at yahoo dot com dot au | Date: | Mon, 19 May 2003 02:42:30 +0000 |
| Subject: | note 32149 added to ref.pcre | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48558@lists.php.net to get a copy of this message | ||
How to have optional spaces. For beginners like me.
I finally found the solution.
I need this so a surname like mine will 'match'. eg. 'De David'
<?function eregi_alpha_sp( $data ) {
if ( eregi('^[[:alpha:]| ]+$', $data) ) {return true;}
return false; }?>
The spaces bit, is '| ]'. The 'pipe' meaning OR and a space.
So, the expression is Alpha OR Space
----
Manual Page -- http://www.php.net/manual/en/ref.pcre.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32149
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32149&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32149&report=yes