The FACE can be ANYTHING pretty much. It can be a word, a series of letters and numbers, some characters like *help* or <help> or pretty much anything. The only thing that's required is the FACE be separated by a space on each side so it doesn't subsitute things like "face" in the word "preface".
id is just a number name is the name the called it (ie: SmileyFace) location is the URL of the image of the name face is the code to s/// if it is found (ie: :) , :( , *hug* ) Right now it's not s/// anything and just spits back the whatever you put in. If you type in "Hello there! :) " it prints it back instead of the emoticon.
Any ideas what I goofed?
I removed \b as suggested in the room but that didn't change the output. I tried removing \Q and \E but it errored out due to a quantifier problem since I have an emoticon face *crying*. THE SCRIPT: this is a basic chatterbox script, much like PM has, that let's people post messages to the site with each other.
####### # connecting to the DB again so we can filter emoticons ####### my $data = qq(SELECT id, name, location, face FROM emoticons); my $sth = $dbh->prepare($data); $sth->execute() or die $dbh->errstr; my ($id, $name, $location, $face); $sth->bind_columns(\$id, \$name, \$location, \$face); foreach my $line (reverse @keep) { my ($username, $message, $date, $ip) = split(/<!!>/, $line); while ($sth->fetch) { $message =~ s|\b\Q$face\E\b| <img src="$location" alt="$name"> | +gi; } if ($message =~ m|^/me|i) { $message =~ s|^/me||i; print qq(<b><i><a href="#" TITLE="Message sent on $date by $ip"> +$username</a></i></b> <i>$message</i><br>); } else { print qq(<b><a href="#" TITLE="Message sent on $date by $ip">$us +ername</a>:</b> $message<br>); } }
In reply to substitutions with unknown data by sulfericacid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |