Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Subscription Stuff

by Zaxo (Archbishop)
on Aug 03, 2002 at 17:18 UTC ( [id://187359]=note: print w/replies, xml ) Need Help??


in reply to Subscription Stuff

You want to match at least one, so use '+' instead of '*' as the quantifier. Having passed that, you want to match a non-digit:

sub is_word_with_nondigit { # $_ = shift; # /^\w+$/ and /\D/; $_[0] =~ /^\w+$/ and $_[0] =~ /\D/; }

A different quantifier may be used if you want a minimum length, like /^\w{4,}$/

Update: Modified code to untaint the sub's argument, instead of checking a copy. If you don't like side effects use the commented-out version.

After Compline,
Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://187359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2025-07-11 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.