Hi Monks,
Not sure what I am doing wrong, so thought of posting this here.
use strict; use warnings; use diagnostics; while (<STDIN>) { chomp; if (/[0-9]{3}/) { print "\tIt Matches.\n"; } else { print"\tIt doesn't match.\n"; } }
Here's what it does:
D:\perlscripts>perl test.pl 1 It doesn't match. 12 It doesn't match. 123 It Matches. 12345 It Matches. 1234567890 It Matches. D:\perlscripts>
I thought {3} should match only 3, not more or less. Please correct if my understanding is wrong.
</code>In reply to Regex {3} matches 3 or more? by pritesh_ugrankar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |