You should be able to \ them just like any other character, if that isn't working you might try backslashing the \. Aka, \\ or even \\\\.

http://danconia.org

Mystik gotan wrote:
Maybe you should use a foreach loop spitting every character and then parsing the \ in front of it?



Sincerly,
Bob Erinkveld
(Webmaster Insane Hosts)
www.insane-hosts.net





From: "Jason Rauer" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Characters instead of regex patterns
Date: Sat, 23 Nov 2002 10:45:40 +0000

Say I have:

foreach $string (@strings) {
if ($text =~ /$string/) { ... }
}

Now, it happens that the data in $string contains \|()[{$^*.? etc. that turn into regex metacharacters within m// but I want to match them by their literal value, not as a regex pattern. That is, now Perl terminates the script because whenever $string happens to contain, say, a ( it interprets it as an unmatched parenthesis in a regex pattern when what I'd like to match is just \(.

How to keep those characters from turning into regex patterns?

Thanks,

Jason


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
MSN Zoeken, voor duidelijke zoekresultaten! http://search.msn.nl/worldwide.asp



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to