Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Detecting if a string is a regular expression

by Kenosis (Priest)
on Jan 10, 2013 at 19:59 UTC ( #1012732=note: print w/replies, xml ) Need Help??


in reply to Detecting if a string is a regular expression

You could create a regex that checks the string for the characters you want to allow, e.g.:

sub isStrOK { return $_[0] =~ /\A[\s\w]+\z/; }

The above's not intended to be exhaustive for allowable characters, but only an example.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1012732]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2017-09-21 04:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (241 votes). Check out past polls.

    Notices?