Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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.


Comment on Re: Detecting if a string is a regular expression
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (15)
As of 2014-09-19 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (137 votes), past polls