q/"this"string"/ =~
m{
" # X
(
[^"]*? # XXXX
)
" # X
}x
Remember why "foo" =~ /o/? It's because there has to be an o in there, but it's location in the string has not been fixed in the regex. Anchoring avoids this problem. ^ matches the null string at the beginning of a line or string, $ matches the null string at the end of a line (right before \n) or string.
"foo" !~ /^o$/;
q/"this"string"/ !~ /^"([^"]*?)"$/;
# X X
++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
- Whreq
|