Gossamer Forum
Home : General : Perl Programming :

Changing :) to an image

Quote Reply
Changing :) to an image
I'm changing around a guestbook script to make certain emoticons be images, but i get errors,
why doesn't this work$in{'Comment'} =~ s/\ Smile/<img src="smile.gif">/g;
Quote Reply
Re: Changing :) to an image In reply to
One reason may be that you need to call the full URL to the image, as you may not store images in the CGI directory.

------------------
WFMY-TV Webmaster
Quote Reply
Re: Changing :) to an image In reply to
Perl's metacharacter list for patern matching is as follows:

\ | ( ) [ { ^ $ * + ? .

You need to escape these whenever you have them in a regex.
Try:
$in{'Comment'} =~ s/:\)/<img src="smile\.gif">/g;

-- Gordon --



------------------
$blah='82:84:70:77';
print chr($_) foreach (split/:/,$blah);

Quote Reply
Re: Changing :) to an image In reply to
Thanks GClemmons, that helped out alot.