
yapp
User
Feb 12, 2002, 10:31 AM
Post #6 of 6
(3085 views)
|
|
Re: [RedRum] RegExp that disables smileys in [code]
[In reply to]
|
Can't Post
|
|
I thought that doesn't matter, and explained enough about the content.. However, here it comes: - All smileys are stored in a hash. %Smileys = ( qq|:)| => 'happy', qq|;)|, 'wink', qq|;D| => 'grin'); - The values will be replaced by <IMG src="/images/smileys/$value.gif"> before the function starts. - The smiley replacement function iterates through the hash, sorted at the length of the smiley. So the rolleyes ::) get's converted before :) - Then replace it. while(my $smiley = shift @sorted) { $message =~ s/\Q$smiley/$Smileys{$smiley}/gi; } ps. If you need the exact details, let me know, because I don't want to copy-paste code right now from my files stored at another computer in my home network. (sorry I replies to RedNum], I ment the post before it, but I'm watching from flat view) Yet Another Perl Programmer _________________________________ ~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~ More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads!
(This post was edited by yapp on Feb 12, 2002, 10:32 AM)
|