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

Re: Checking user input on dynamic regular expressions

by Tyke (Pilgrim)
on Apr 02, 2001 at 13:04 UTC ( #68958=note: print w/replies, xml ) Need Help??

in reply to Checking user input on dynamic regular expressions

I think you might want to pass $input through the quotemeta function in order to make sure that any regexp special characters are correctly escaped.

I don't see why it would be pointless...

Update Ack, of course it's pointless.

add_to_todo_list(q(Think _BEFORE_ posting));
Begs pardon...

Replies are listed 'Best First'.
Re: Re: Checking user input on dynamic regular expressions
by cLive ;-) (Prior) on Apr 02, 2001 at 13:11 UTC
    $reg_exp = '\d{4}'; $string = 'The year is 2001, the month is April.'; $req_exp = quotemeta $req_exp; $string =~ /($req_exp)/; print $1;
    That doesn't print '2001', because it's trying to match \\d\{4\} instead of \d{4}

    cLive ;-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://68958]
[Eily]: Easy, fetch the list of all the modules that are not on CPAN and remove the ones on Github
[Corion]: Eily: Sure, but I haven't written that yet ;)
[Eily]: wait, *keep* only the ones on Github, otherwise you'll still have an infinit list
[Eily]: Corion so until you write it, the module that lists the module that do not exist on CPAN should return itself
choroba has just learned how to tell a chemist from a blue collar
[Corion]: Eily: Wheee! ;))

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2017-04-24 09:15 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (437 votes). Check out past polls.