Err, what's that regular expression supposed to do? Perhaps you meant to use /[^\w\.@\\]/ instead of /[-\w\.@\\]/?
(Your question would also be a lot more clear if you were specific -- what's an example of a character that is treated wrongly. What were you expecting and what happened?)
Generally speaking, if you're worried about security you should explicitly include characters, not blacklist a few you think are dangerous. Because usually more are dangerous than you know.
You might also find it more useful to use encodeURIComponent(myErrorText) or maybe encodeURI(myErrorText), depending on just what it is you want to do. [What do you want to do?]
Thanks for the response. Will look into your comments tomorrow.
What I am attempting to do is capture an error message, and using a curl/AppleScript trigger a php to send me an email with the error I do have this working beautifully, but there is a strong chance that a character will be used (speech marks, spaces, non standard characters) that will error in the line of code to invoke the php script. I have manually done replaces for speech marks and spaces, but am not able to foresee all eventualities. This is my first dig into regex, so very much a training exersise for me. I hope this makes it clearer. Thanks agan Roy
Yes, the encodeURI() is exactly what I was looking to do. Thanks for the heads up!