note
AnomalousMonk
<p>
<c>
c:\@Work\Perl\monks>perl -wMstrict -le
"my $string = '/.*u\/ba$/i';
;;
my $rx = eval 'qr' . $string;
print $rx;
print 'A: match' if 'u/Ba' =~ $rx;
;;
my $ry = qr{ \A foo $rx }xms;
print $ry;
print 'B: match' if 'foolubatU/bA' =~ $ry;
"
(?i-xsm:.*u/ba$)
A: match
(?msx-i: \A foo (?i-xsm:.*u/ba$) )
B: match
</C>
</P>
<p>
<b>Update:</B> Of course, given that you're dealing with user-supplied data and considering the danger of an injection attack, maybe one should think twice about an [doc://eval]-based approach.
</P>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-634253">
<hr><p>Give a man a fish<b>:</B> <c> <%-{-{-{-<</C></P>
</div></div>
1208734
1208774