This results in!/usr/bin/perl $a = "http://www.myurl.com/e.php?a"; $b = "http://www.myurl.com/e.php?a"; if ($a =~ /$b/) { print "FOUND\n"; } else { print "NOT FOUND\n"; } $a = "http://www.myurl.com/e.php"; $b = "http://www.myurl.com/e.php"; if ($a =~ /$b/) { print "FOUND\n"; } else { print "NOT FOUND\n"; }
I suppose I am completely stupid... I suppose the ? is being interpreted as a regular expression character to the preceeding p? Why does the second match, but the first does not? How to remedy this?NOT FOUND FOUND
In reply to Regular expression help: why does this not match? by lokiloki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |