
Laurent_R
Enthusiast
Nov 29, 2012, 4:08 AM
Post #3 of 3
(443 views)
|
|
Re: [g0blu322] Matching rules in Perl
[In reply to]
|
Can't Post
|
|
Hum, a couple of points.
if($string == /[3579][02468]/) { print "$string is an odd digit followed by an even digit"; } 1. If your string is 12, it will not match because you don't have 1 in your first character class; 2. If you get a match, this does not mean at all that "$string is an odd digit followed by an even digit", it means that "$string contains, somewhere, an odd digit (but not 1) followed by an even digit", so that 'foo36bar}%"&\' will match your regex. Of course, the same remark can be made about the other matches in you code. Otherwise, please tell us what strings fall into the default "no conditions" message, as I am fairly sure that 'A_7', for excample, should match your second regex (and not the first one).
|