Bug in preg_match() ?
| From: | Michael Spector | Date: | Sun, 11 Jul 2004 17:41:45 +0000 |
| Subject: | Bug in preg_match() ? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-11092@lists.php.net to get a copy of this message | ||
Hi,
This script:
<?
$line = "Use operator m// for matching strings";
$pattern = "m//";
if(preg_match("/$pattern/", $line, $match)) {
print $match[0]."\n";
}
?>
outputs the following error:
<br />
<b>Warning</b>: Unknown modifier '/' in
<b>/home/michael/bug.php</b> on
line <b>5</b><br />
I thought it should find the match "m//" ...
Can you say, why search of the ending delimiter in a pattern cannot
be performed in a simple way, as you can see in the attached patch ?
Thanks.