in reply to How do I avoid regex engine bumping along inside an atomic pattern?

Offhand, I don't see any straightforward way to modify the regex object $c to achieve the result you want. The hard fact is, there is an 'x' in $str at offset 6 that is preceded by zero or more $c.

I think the simplest approach is to use an additional anchor for the match. Since $c consumes everything up to and including the newline, if you begin the match of whatever follows $c with a start-of-(embedded)-line anchor, you get the desired results for the example string given.

perl -wMstrict -le "my $c = qr{ (?> -- [^\n]* (?:\n|\z)) }xms; my $str = qq(a --b x\n x); print qq(match at positions $-[1]-), $+[1]-1 if $str =~ m{ ($c* [ ] x) }xms; " match at positions 2-9 perl -wMstrict -le "my $c = qr{ (?> -- [^\n]* (?:\n|\z)) }xms; my $str = qq(a --b x\n x); print qq(match at positions $-[1]-), $+[1]-1 if $str =~ m{ ($c* x) }xms; " match at positions 6-6 perl -wMstrict -le "my $c = qr{ (?> -- [^\n]* (?:\n|\z)) }xms; my $str = qq(a --b x\n x); print qq(match at positions $-[1]-), $+[1]-1 if $str =~ m{ ($c* ^ [ ] x) }xms; " match at positions 2-9 perl -wMstrict -le "my $c = qr{ (?> -- [^\n]* (?:\n|\z)) }xms; my $str = qq(a --b x\n x); print qq(match at positions $-[1]-), $+[1]-1 if $str =~ m{ ($c* ^ x) }xms; "

(The last example had no output, i.e., no match.)

BTW - These examples were run under Perl 5.8. The 5.10 regex possessive quantifiers might be worth investigating, but I think they are just shorthand for the (?> ... ) 'atomic' construct and would give the same results.