I had the following thing to achieve:
for a Homesite extension, I needed the data of a textarea to be put in a textfield and all real linebreaks to become \n ...
Sound easy but was quite a pain, as I tried to make a nl2br and change the br's back to \n, no can do, as PHP surrounds them by linebreaks.
Now the solution is ridiculously easy:
I am sure there is some nifty regular expression as well, but that's how I got lucky.
No rocket science, but hey...