Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Do I need to do escaping in my regex check?

by choroba (Cardinal)
on Mar 14, 2022 at 14:34 UTC ( [id://11142084]=note: print w/replies, xml ) Need Help??


in reply to Do I need to do escaping in my regex check?

If you are checking one of the values is present, you don't need a regex at all.
if (! grep $_ eq $value, @$enum_values) {

If you want to match regexes, you need to store regexes, not strings. Use quotemeta to escape the strings.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-20 01:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found