in reply to How do I avoid regex engine bumping along inside an atomic pattern?
You could look for non-comments after a line beginning instead of comments before a line ending:
my $c= qr/(?:\A|\n)([^-]|-[^-])/; $str =~ m/$c* x/;
(Yes, that regex could use some forward lookahead, but I always have to look up the syntax so I'll leave that as an exercise.)
Generally such constructs are easier to parse if you only look at one line per string
|
|---|