https://bugs.exim.org/show_bug.cgi?id=1875
Bug ID: 1875
Summary: Options set in the pattern aren't being "globalized"
anymore
Product: PCRE
Version: N/A
Hardware: All
OS: All
Status: NEW
Severity: bug
Priority: medium
Component: Code
Assignee: ph10@???
Reporter: bjourne@???
CC: pcre-dev@???
Doc says:
"For example, (?im) sets caseless, multiline matching. It is also possible to
unset these options by preceding the letter with a hyphen, and a combined
setting and unsetting such as (?im-sx), which sets PCRE_CASELESS and
PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED, is also
permitted. If a letter appears both before and after the hyphen, the option is
unset.
The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA can be
changed in the same way as the Perl-compatible options by using the characters
J, U and X respectively.
When one of these option changes occurs at top level (that is, not inside
subpattern parentheses), the change applies to the remainder of the pattern
that follows. If the change is placed right at the start of a pattern, PCRE
extracts it into the global options (and it will therefore show up in data
extracted by the pcre_fullinfo() function)."
http://www.pcre.org/original/doc/html/pcrepattern.html
But it appears to not be the case anymore. In this abbreviated sample code:
pcre *c = pcre_compile("(?im)abc", 0, &err_str, &err_ofs, NULL);
pcre_fullinfo(c, NULL, PCRE_INFO_OPTIONS, &opts)
printf("%d", opts & PCRE_MULTILINE);
With pcre 8.35, "2" is printed, with pcre 8.39 "0" is printed. It is the same
story with the other options you can set in "(?)"-thingies.
--
You are receiving this mail because:
You are on the CC list for the bug.