in reply to Regex: Overlapping Matches: Double Execution of Eval-ed Code
Note the absence of zero-width matches; together with the (*FAIL), this causes the regexp engine to restart with the next character. The zero-width technique relies on the engine making an exception: a second successive zero-width match is rejected -- however, in order to determine the second match has zero length, it has to execute the block."abcd" =~ /(..) (?{push @pairs, $1}) (*FAIL)/xs; say "@pairs"; __END__ ab bc cd
|
|---|