Edit report at http://bugs.php.net/bug.php?id=54702&edit=1
ID: 54702 Updated by: fel...@php.net Reported by: gwbv at yahoo dot com Summary: character @ not handled properly with \b -Status: Open +Status: Bogus Type: Bug Package: PCRE related Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: This is not a bug. >From PCRE library documentation: " \Biss\B which finds occurrences of "iss" in the middle of words. (\B matches only if the current position in the subject is not a word boundary.) " I.e. \b just makes sense surrounding another word. re> /!\b/ data> ! No match data> re> /a\b/ data> abc a 0: a Previous Comments: ------------------------------------------------------------------------ [2011-05-10 19:02:35] gwbv at yahoo dot com Description: ------------ Hi, I have a problem with the @ character at the end of a word, with the word delimiter \b: input: i wrote this exampl@ for you preg_match('/\bexampl@/','i wrote this exampl@ for you') = 1 preg_match('/\bexampl@\b/','i wrote this exampl@ for you') = 0 the second preg_match should also return 1 !! Test script: --------------- <?php $input='i wrote this exampl@ for you'; echo "input: ".$input."\n"; $patt='/\bexampl@/'; echo "preg_match('".$patt."','".$input."') = ".preg_match($patt, $input)."\n"; $patt='/\bexampl@\b/'; echo "preg_match('".$patt."','".$input."') = ".preg_match($patt, $input)."\n"; ?> Expected result: ---------------- for both preg_match, output should be 1, that is, the pattern should be found in the input string preg_match('/\bexampl@/','i wrote this exampl@ for you') = 1 preg_match('/\bexampl@\b/','i wrote this exampl@ for you') = 1 Actual result: -------------- preg_match('/\bexampl@/','i wrote this exampl@ for you') = 1 preg_match('/\bexampl@\b/','i wrote this exampl@ for you') = 0 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54702&edit=1