Mistake in documentation (PCRE)
| From: | Miroslav Pecka | Date: | Sat, 18 Dec 2004 14:05:29 +0000 |
| Subject: | Mistake in documentation (PCRE) | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969365512@lists.php.net to get a copy of this message | ||
I think I found the mistake in documentation
PHP->PCRE->Pattern Syntax->Internal option setting.
(http://cz2.php.net/manual/cs/pcre.pattern.syntax.php)
I disagree with:
---
"For settings that are outside any subpattern (defined below), the effect is the same as if the
options were set or unset at the sta
rt of matching. The following patterns all behave in exactly the same way:
(?i)abc
a(?i)bc
ab(?i)c
abc(?i)
which in turn is the same as compiling the pattern abc with PCRE_CASELESS set. "
---
My examples:
$re="/ab(?i)c/";
$str="AbC";
$result=preg_match($re,$str,$regs); //returns 0 - no match
$re="/abc/i";
$str="AbC";
$result=preg_match($re,$str,$regs); //returns 1 - match
It looks like internal modifier operates only right from the position where it is used.
(So it works as if the whole pattern would be the top-level subpattern.)
Do you agree with me? ..or it is only my misapprehension?
I use PHP 4.3.3 (Win).
Thank you for your anser.
Miroslav Pecka