regex grrr

2006-03-07 Thread Tom Allison
Here's my problem: $one = 'this (is a) 1/2 measure example'; Try and run that through a regex like if ( $two =~ /$one/ ) { and it's pretty ugly. Who do I get the literal string for $one? In this case I think it would be something like: $two =~ /this \(is a\) 1\/2 measure example/ -- To unsu

Re: regex grrr

2006-03-07 Thread Tom Phoenix
On 3/7/06, Tom Allison <[EMAIL PROTECTED]> wrote: > $one = 'this (is a) 1/2 measure example'; > > Try and run that through a regex like > > if ( $two =~ /$one/ ) { I think you're looking for the quotemeta() operator, and its cousin the \Q escape. See perlfunc. Hope this helps! --Tom Phoenix Ston

RE: regex grrr

2006-03-07 Thread Timothy Johnson
; if($two =~ /\Q$one/){ print "YES!\n"; } ## -Original Message- From: Tom Allison [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 07, 2006 10:59 AM To: beginners@perl.org Subject: regex grrr Here's my problem: $one = 'this (is a) 1