in reply to Re^2: Regex: continue from previous match
in thread Regex: continue from previous match

Your example of an 'a' followed by any one char will not match variable length

Sure it works with variable length patterns.

while ('abxxxacdxxxae' =~ /a([^x]+)/g) { say $1; }

Your example of an 'a' followed by any one char will not match [...] different ways at the same position

Cause you didn't ask that. You asked about matching no earlier than pos.

The only way to make the regex engine backtrack is to cause the match to fail.

'abcd' =~ /(.*) (?{ say $1 }) (?!)/sx