in reply to Re: Re: Regex ERROR!
in thread Regex ERROR!
\Q quote (disable) pattern metacharacters till \E
look at this code:
$comm = '(xyz'; $line = '123(xyz)456'; if ($line =~ /$comm/) { #error! same as $line =~ /(xyz/ which ha +s an unmatched '(' # do stuff } if ($line =~ /\Q$comm/) { #no error! same as $line =~ /\(xyz/ -- ' +(' is escaped # do stuff }
--
flounder
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^3:: Regex ERROR!
by nofernandes (Beadle) on Jul 15, 2003 at 13:51 UTC | |
|
Re: Re^3:: Regex ERROR!
by PodMaster (Abbot) on Jul 16, 2003 at 09:17 UTC |