[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] Fwd: weird perl bug
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@mutationgrid.com | http://mutationgrid.com | 1-402-598-7782