On Sat, Dec 25, 2010 at 02:26:59PM -0800, Jacob Gelbman wrote: > # New Ticket Created by Jacob Gelbman > # Please include the string: [perl #81286] > # in the subject line of all future correspondence about this issue. > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81286 > > > > Under Perl 5.12.1, the following test does not succeed. > > use Test::More; > $_ = "abc"; > ok /\G^/gc; > ok /\G^/gc; # not ok > > Since you can't be on the "other side" of an assertion, I would expect > subsequent regexes to work as the one before them. > > Also, if between the regexes, I put the following, things work as > expected: > > pos($_) = pos($_); I think this comes from not allowing two succesful, zero-length matches (note you don't need the /c for the behaviour): use Test::More; $_ = "abc"; use re 'debug'; ok /\G^/g; ok /\G^/g; # not ok done_testing; __END__ Compiling REx "\G^" Final program: 1: GPOS (2) 2: BOL (3) 3: END (0) stclass END anchored(BOL)(GPOS) GPOS:0 minlen 0 Compiling REx "\G^" Final program: 1: GPOS (2) 2: BOL (3) 3: END (0) stclass END anchored(BOL)(GPOS) GPOS:0 minlen 0 Matching REx "\G^" against "abc" 0 <> <abc> | 1:GPOS(2) 0 <> <abc> | 2:BOL(3) 0 <> <abc> | 3:END(0) Match successful! ok 1 Matching REx "\G^" against "abc" 0 <> <abc> | 1:GPOS(2) 0 <> <abc> | 2:BOL(3) 0 <> <abc> | 3:END(0) Match possible, but length=0 is smaller than requested=1, failing! Match failed not ok 2 # Failed test at /tmp/ss line 15. 1..2 # Looks like you failed 1 test of 2. Freeing REx: "\G^" Freeing REx: "\G^" I think it's working as intended. AbigailThread Previous