Perl-Sensitive Sunglasses | |
PerlMonks |
Regex bug? (/u not cooperating with /x)by mrpeabody (Friar) |
on Oct 24, 2007 at 04:04 UTC ( [id://646816]=perlquestion: print w/replies, xml ) | Need Help?? |
mrpeabody has asked for the wisdom of the Perl Monks concerning the following question:
This works:
This doesn't: 523 $ perl -we'my $x = "bar"; print "yes" if "fooBarbaz" =~ /\u $x/x' In other words, the \u operator can't be separated from the following atom by whitespace, even under \x. If it is, it silently fails to have an effect. The same thing happens if you use the string "bar" directly instead of $x. Perhaps this is just an artifact of \u being more of a double-quote interpolation operator, as opposed to a regex operator proper. But it seems odd (wrong) that "\b $word" works fine while "\u $word" fails. Is there a chance of getting this changed, or is there some good reason why it works this way? This is perl, v5.8.8 built for cygwin-thread-multi-64int
Back to
Seekers of Perl Wisdom
|
|