Mar 16, 2009, 10:57 AM
Post #5 of 7
Re: [devkpict] Escaping special characters from regular expressions
[In reply to]
1. You might want to use an alternative regex delimiter since you are matching on strings containing the default '/', although you imply that your code compiles, so maybe that's irrelevant in this case:
if ($line =~ m|$_|g )
2. Of course m|/abc/pg| matches '/abc/pqrs', or anything else before or after. You'll have to make the pattern more specific to your data. Hints:
# Constrain match to the end of the line.
# Constrain match to the end of the word.
# Constrain match to a trailing character delimiter, like another slash.