[thelist] Write Only Perl Question...
Garrett Coakley
garrett at polytechnic.co.uk
Tue Aug 28 17:03:08 CDT 2001
On Tue, Aug 28, 2001, Mike DeHart said:
>Help!
>
>My Perl is passable at best & when it gets to this elegantly concise sort
>of stuff, the right hand side that is... I'm totally at a loss!
>
><snippet>
>
>if ($verify_new_users && $FORM{'action'} =~ /^\w{2}\d{7}$/) { ...bla bla
bla }
Well, my perls probably not much better than yours, but I'll take a stab
at it. It looks like it's checking that the var $verify_new_users exists
and that the form action equals:
^ = Anchor the pattern to the beginning os the string
\w{2} = at least two word chars (a-z A-Z 0-9 or _)
\d{7} = at least seven digits
$ = the end of the string
So, action = fo1234567 would be ok, but fool12345 wouldn't.
Thats what I reckon anyway, but you're probably better waiting for a more
qualified answer from someone who knows what they're talking about *:)
G.
--
--------------------------------------------------------------------------
WORK: http://spiked.co.uk
PLAY: http://polytechnic.co.uk
More information about the thelist
mailing list