Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2016-10-28 19:09 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (386 votes). Check out past polls.