Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Regex won't match.

by Sue D. Nymme (Monk)
on Sep 20, 2009 at 22:52 UTC ( [id://796439]=note: print w/replies, xml ) Need Help??


in reply to Regex won't match.

Probably what you're doing wrong is assigning the string to the variable wrong. But since you didn't show how you did that, it's just a guess.

Usually, what you want to do is this:

$TERMSDEF = qr/\b\w+\b|(?:'.+?')|(?:".+?")/;

That will preserve all the regex semantics, keep your code readable, cure cancer, etc.

Replies are listed 'Best First'.
Re^2: Regex won't match.
by ikegami (Patriarch) on Sep 21, 2009 at 02:19 UTC

    To be equivalent, it should be:

    $TERMSDEF = qr/\b\w+\b|(?:'.+?')|(?:".+?")/isx;

    Mind you, the "i" and "x" are useless here, but the "s" is necessary.

Re^2: Regex won't match.
by Anonymous Monk on Sep 20, 2009 at 22:57 UTC
    Excellent! It works now. Thank you.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-25 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found