note 40325 added to ref.pcre
| From: | johnnyatwbshdotspbdotru at rn2 dot php dot net | Date: | Sun, 29 Feb 2004 00:45:32 +0000 |
| Subject: | note 40325 added to ref.pcre | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65971@lists.php.net to get a copy of this message | ||
Damned PHP! Sorry.
One can determine by no way, whether regular expression matching empty string matches or not.
preg_match('/a(.?)b/', 'ab', $match); // $match[1] is set and empty
preg_match('/a(.?)c|a(.?)b/', 'ab', $match); // $match[1] is set and empty
There is no difference!
As an example, similar code on Perl:
'ab' =~ /a(.?)b/; # $1 is defined and equals empty string
'ab' =~ /a(.?)c|a(.?)b/ # $1 is undefined
Does it mean "Perl-compartible"? I think, no.
If anyone knows a solution, please send me e-mail.
----
Manual Page -- http://www.php.net/manual/en/ref.pcre.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40325
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40325&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40325&report=yes
Search -- http://master.php.net/manage/user-notes.php