[Omaha.pm] Fwd: weird perl bug
Jay Hannah
jhannah at mutationgrid.com
Fri Nov 19 09:01:46 PST 2010
On Nov 19, 2010, at 10:48 AM, Andy Lester wrote:
> $text =~ m/\"Because of Winn\-Dixie\"/
>
> because he is afraid that " and - have to be escaped in a regular expression. They do not.
You have to be careful with - inside sets though. Sometimes that - does need to be escaped. :)
my $string = "123-abc";
print $string =~ /^[123abc]+$/ ? "y" : "n";
print $string =~ /^[123-abc]+$/ ? "y" : "n";
print $string =~ /^[123\-abc]+$/ ? "y" : "n";
nny
Jay Hannah
Software Architect
jhannah at mutationgrid.com | http://mutationgrid.com | 1-402-598-7782
More information about the Omaha-pm
mailing list