On exercise 8.2 from Learning Perl 3rd there is this regex:
/"([^"]*)"/
This is supposed to match a simple double-quoted string like
"hello", but not "hello"you" (nor "hello\"you"). The only problem is that it is matching the latters. I tried it like this:
/"([^a]*)"/ and well enough, it wouldn't match any word that contained an a in it (ie: "wilma"), so what am I'm missing?
PS: I should add that one-liner does work:
perl -wle '$a = "hello\"you";if ($a =~ /"([^"]*)"/){ print "yes"}else{print "no"}'
Just not on the script which adds to the weirdness of it...
Edit by dws for code tags and clearer title