in reply to The Mysteries Of LineBreaks
If you are having trouble with replacing two characters, you could for instance strip out all \r characters, either before replacing, or even before you are saving that input to file.
But probably the simplest approach is to do something like this (untested and ugly code):
That is, replace occurances of an optional \r and a non-optional \n with first <p> for double matches, and then <br> for single ones left after the first pass.s/(\r?\n){2}/<p>/g; s/\r?\n/<br>/g;
Hope that helps.
|
|---|