Bug #11461: \. after \- does not work
| From: | aweber at multamedio dot de | Date: | Wed, 13 Jun 2001 09:25:01 +0000 |
| Subject: | Bug #11461: \. after \- does not work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-57003@lists.php.net to get a copy of this message | ||
From: aweber@multamedio.de
Operating system: Linux 2.2.16-SMP
PHP version: 4.0.4pl1
PHP Bug Type: Regexps related
Bug description: \. after \- does not work
I tried to check email with
$check =
ereg('^[0-9A-Za-z_\-\.]+@[0-9A-Za-z_\-]+\.[0-9A-Za-z_\-\.]+[0-9A-Za-z_\-]+$',$email);
This does not work with 'xxx-yyy@zzz.com', for example, althoug the regular expression is
correct. It works this way in any other programming language.
But if you write it in the following way it also works fine in PHP:
$check =
ereg('^[\.0-9A-Za-z_\-]+@[0-9A-Za-z_\-]+\.[\.0-9A-Za-z_\-]+[0-9A-Za-z_\-]+$',$email);
Maybe the parser thinks of "-" as the range separator, althoug it is written as \- ?
--
Edit Bug report at: http://bugs.php.net/?id=11461&edit=1