Jul 8, 2001, 12:30 AM
Post #2 of 3
I think that's because there's some line like
|somewhere before in your script. This line replaces all occurrences of :) even if it occurs within a >:). There are now several ways to solve this problem. First, you can sort your search-and-replace lines in order of character length of the emoticons, starting with the longest. All other ways would require me to have a look on your set of emoticons. But you may try sorting first.
$xline =~ s/:\)/<img src=\"imgs\/ms\/4.gif\">/g;
Did you know you can use different characters than / for quoting regexes? You can write
$xline =~ s[:\)][<img src="imgs/ms/4.gif">]g;
which will save you from escaping all those slashes in your pathnames.
$xline =~ s!:\)!<img src="imgs/ms/4.gif">!g;
Hope this helps.