Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 pondering the Monastery: (7)
As of 2015-07-07 10:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls