keiusui has asked for the wisdom of the Perl Monks concerning the following question:
In other words, what will this print:
$s = "xxxxxxxxxxxxxxxxxxxx!"; if($s =~ /^\w{6,20}$/){print "it's a match";} else{print "no match";}
I think there is no match because the ^ and $ make sure that the string contains ONLY between 6 and 20 alphanumerics (and underscores) and nothing else. Am I right?
Update from one of my friends: weirdness... when i try from the cmdline using this (perl -e 'print "yes\n" if (q{a} x 20 . q{!} =~ m/^\w{6,20}$/);', it appears to, but not with this: perl -e '$c = q{a} x 20 . q{!}; print "yes\n" if ($c =~ m/^\w{6,20}$/);'
Edit: g0n - code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: another question on a string of 20 letters
by pKai (Priest) on Feb 04, 2006 at 21:28 UTC | |
by ikegami (Patriarch) on Feb 04, 2006 at 21:33 UTC | |
|
Re: another question on a string of 20 letters
by GrandFather (Saint) on Feb 04, 2006 at 21:15 UTC |