note 40325 deleted from ref.pcre by irchtml
| From: | irchtml@php.net | Date: | Sun, 29 Feb 2004 02:10:09 +0000 |
| Subject: | note 40325 deleted from ref.pcre by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65974@lists.php.net to get a copy of this message | ||
Note Submitter: johnny at wbsh dot spb dot ru
----
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.