note 25043 added to ref.regex
| From: | paper at rack1 dot php dot net | Date: | Mon, 09 Sep 2002 04:57:24 +0000 |
| Subject: | note 25043 added to ref.regex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36370@lists.php.net to get a copy of this message | ||
I have also experienced the same problem as bps7j@yahoo.com had been experiencing, except I did not
recognize the problem until after many hours of debugging.
"\s" does not seem to represent spaces, however "[[:space:]]" does.
Another problem I was having was matching dashes/hyphens '-'. You must escape them
"\-" and place them at the end of a bracket expression.
Example: To match a blank string or a string containing only uppercase letters, underscores, spaces,
and hyphens:
^([A-Z_\-]|[[:space:]])*$
Hope this saves someone some time from debugging like I was. :)
--
http://www.php.net/manual/en/ref.regex.php
http://master.php.net/manage/user-notes.php?action=edit+25043
http://master.php.net/manage/user-notes.php?action=delete+25043
http://master.php.net/manage/user-notes.php?action=reject+25043