CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [saaiber] substitute \' in mail with ': Edit Log



rork
User

Sep 5, 2006, 2:20 AM


Views: 12119
Re: [saaiber] substitute \' in mail with '

The mail from the forum has \' in it, the regexp substitutes the ' in \' so it will end in \\' where the first \ escapes the second \ and leaves a normal'. Now the text has a regular ' and the script crashes.

Uncomment the line and all original ' will create the problem. You have to test if an ' is escaped allready but it might be easier to also substitute the original \:

try this one:

Code
s/\\?'/\\'/g


But what if someone sends you some nice ASCII art by mail? \\'O'//
Edit:
Well most of it would be destroyed by the other substitution operators but not the backslashes. Maybe < $body =~ s/<[\/!]*?[^<>]*?>//g; > doesn't exactly do what you want.

(I took another look because I wondered how it handled normal backslashes in the text but it doesn't do anything with them it seems)
--
Don't reinvent the wheel, use it, abuse it or hack it.

(This post was edited by rork on Sep 5, 2006, 10:11 AM)


Edit Log:
Post edited by rork (User) on Sep 5, 2006, 10:11 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives