On Fri, 3 May 2002, Estep, Greg {PBSG} wrote:
> I am writing a piece of code for the UNIX environment which needs to pass a
> message string of unknown content which can include any printable ASCII
> value. I am looking for the best way to escape the "special" values. My
> code (it accomplishes the goal) at this time is:
>
> $sMessage =~ s/\\/\\\\/g; # escape '\'
> [....]
> $sMessage =~ s/\$/\\\$/g; # escape '%'
>
> Please give me your suggestions as to the best approach.
How about:
$sMessage =~ s/([\\|()<>;`'&%])/\\$1/g;
--
Ernest MacDougal Campbell III, MCP+I, MCSE <[EMAIL PROTECTED]>
http://dougal.gunters.org/ http://spam.gunters.org/
Web Design & Development: http://www.mentalcollective.com/
This message is guaranteed to be 100% eror frea!
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs