The last task, to match a question, can be solved quite easily by reversing the string.
my ($m) = reverse($myvar) =~ /"\?(.*?)"/s; $m = reverse $m; print "matched <$m>\n";
Note that it's OK to use .*? here. And due to optimizations in the regex engine it's even faster to use it than a negative char class, if the following pattern is constant as it is in this case.

It's also very easy to make it work for escaped quotes by adding a negative look-ahead.     my ($m) = reverse($myvar) =~ /"\?(.*?)"(?!\\)/s; Note that here you must use .*? instead of a negative char class since you want the engine to backtrack.


In reply to Re: Death to Dot Star! by Anonymous Monk
in thread Death to Dot Star! by Ovid

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":