#30435 [Opn]: Preg_Match ignoring word boundaries
| From: | wberg at doce dot ufl dot edu | Date: | Fri, 15 Oct 2004 13:07:12 +0000 |
| Subject: | #30435 [Opn]: Preg_Match ignoring word boundaries | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67620@lists.php.net to get a copy of this message | ||
ID: 30435
User updated by: wberg at doce dot ufl dot edu
Reported By: wberg at doce dot ufl dot edu
Status: Open
Bug Type: PCRE related
Operating System: Linux 2.4.21-alpha-r4
PHP Version: 4.3.9
New Comment:
"The match does not find "armé" as a whole word in $Blazon, but does
find it in $Blazon2, although it isn't a whole word there."
Should be:
The match does not find "armé" as a whole word in Blazon, but does find
it in Blazon 2, although it isn't a whole word there.
Previous Comments:
------------------------------------------------------------------------
[2004-10-14 16:17:32] wberg at doce dot ufl dot edu
Description:
------------
I run PHP 4.3.4 locally on Win XP Pro / ISS 5. The code supplied works
flawlessly.
On the Linux server, however, which currently runs PHP 4.3.9, it seems
to ignore or mess up the \b word boundaries. The same thing happened
when the server ran PHP 4.3.3RC1. Upgrading to 4.3.9 didn't help.
You can see the code in action, where it produces the wrong results, on
the Linux server at:
http://www.kuruvinda.com/test.php
You can get full PHP info() on this server at:
http://www.kuruvinda.com/c.php
Reproduce code:
---------------
<?php
$Pattern = "\b[aàáâäå]rm[eèéêë]\b";
$Blazon = "D'argent, au lion d'azur, armé et lampassé de gueules, (le
lion est quelquefois chargé d'une fleur-de-lis d'or, ou d'un écusson
d'or à l'aigle éployée de sable).";
print "Pattern: $Pattern<p>Blazon: $Blazon<p>";
# Should return "Found"
if (preg_match("/".$Pattern."/i",$Blazon)) {
print "Found";
} else {
print "Not Found";
}
$Blazon = "D'argent, au lion d'azur, armée et lampassé de gueules, (le
lion est quelquefois chargé d'une fleur-de-lis d'or, ou d'un écusson
d'or à l'aigle éployée de sable).";
print "<p>Pattern: $Pattern<p>Blazon 2: $Blazon<p>";
# Should return "Not Found"
if (preg_match("/".$Pattern."/i",$Blazon)) {
print "Found";
} else {
print "Not Found";
}
?>
Expected result:
----------------
The match should find "armé" as a whole word only in $Blazon and not in
$Blazon2.
Actual result:
--------------
The match does not find "armé" as a whole word in $Blazon, but does
find it in $Blazon2, although it isn't a whole word there.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30435&edit=1