Hi all,
This is really a general regex question, and while I'm doing it in Perl, I guess it's not necessarily language specific.
I have a regex that is catching more than I expect. Here is my code:
if ($comment =~ /902|921/) { print "Found"; }
Someone submitted the following, though, and it matched the regex:
$500 for a 2bedroom
Now, I expected it to only catch if $comment contained either "902" or "921". Theoretically, I could understand if it would only match 9 followed by 0 followed by (2 or 9), followed by 2, followed by 1, but that's not happening, either. The best I can tell, it only matched because of the single 2.
I thought that the above was a fluke until someone made a much longer post today that matched the regex. The only numbers it contained were:
128533
Am I misunderstanding how the regex works? Or is there something different about matching integers than a regular text string?
TIA!