Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: substitutions with unknown data (\b is \w not \s)

by sulfericacid (Deacon)
on Mar 28, 2005 at 20:37 UTC ( [id://442947]=note: print w/replies, xml ) Need Help??


in reply to Re: substitutions with unknown data (\b is \w not \s)
in thread substitutions with unknown data

Thanks for that code. I inserted it but I'm still having the same problem. I'll keep using it though since it's definitely better than what I was using.

I insterted a little test to do a printout of the faces to make sure we are using the right data.

I added

my ($username, $message, $date, $ip) = split(/<!!>/, $line); while ($sth->fetch) { $message =~ s|(?<!\S)\Q$face\E(?!\S)| <img src="$location" alt=" +$name"> |gi; print "$face<br>"; }
And the output was
*Crying* :) :( :P :O *hug* *flower* ;) *evil* *love* *yawn* 0<- albie *thumb* *angel* *cool* pix action test test: oh pix: emoticon :) test pix: emoticon :) test test: *hug* test: *hug* test: *hug* test: *hug* test: test :) here *hug* test test: test :) here *hug* test
So the $face data IS right but it's still not doing any of the s/// in the data. Any other suggesitons?

Thanks.



"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Replies are listed 'Best First'.
Re^3: substitutions with unknown data (\b is \w not \s)
by tye (Sage) on Mar 28, 2005 at 21:14 UTC

    This wouldn't show if you had spaces in your "face" strings, for example.

    For a situation like this, I'd probably just use "perl -d", set a break point at the loop and use "x $message" and "x $face" a couple of times.

    But you can also use something like Data::Dumper to get some more precise information about your data.

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://442947]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-25 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found