Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: regex search fails

by friedo (Prior)
on Mar 12, 2009 at 14:41 UTC ( #750174=note: print w/replies, xml ) Need Help??


in reply to regex search fails

Try print if /\Q$pattern/. Since your pattern contains the literal string '$testVar', using the \Q escape will prevent it from being interpolated in the match.

Replies are listed 'Best First'.
Re^2: regex search fails
by stephanm (Sexton) on Mar 12, 2009 at 23:03 UTC
    Thanks everyone. The \Q did the trick.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://750174]
help
Chatterbox?
belg4mit kicks Perl in the shins, "Unmatched ) in regex; marked by" my ass
[belg4mit]: Nothing wrong with perl -le 'print ":)" =~ /(?^u:^(\:|\:\))$) /'
[Lotus1]: belg4mit are you on a Linix server?
[belg4mit]: yes. the regular expression is generated in code from a text file. that s the regular expression that Perl blows up when it reaches it, but if I use it from the comman line it's fine
[belg4mit]: oh, wait, damn, different lne number
[choroba]: same Perl version?
[choroba]: oh, ok
[belg4mit]: I had \Q'd in one RE but not a subsequent one, doh

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-04-25 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (460 votes). Check out past polls.