0

I want to remove all single carriage returns but not two or more carriage returns if they are followed by each other.

remove ¶ but not ¶¶

i.e.

s.replace(/[\n\r]/g, '');

removes all return lines

Charles Morrison
  • 418
  • 1
  • 4
  • 23

1 Answers1

0
                obj.Summary = obj.Summary.replace(/(\n){2,}/g, '¶');
                obj.Summary = obj.Summary.replace(/[\n\r]/g, '');
                obj.Summary = obj.Summary.replace(/[¶]/g, '\n\r');
Charles Morrison
  • 418
  • 1
  • 4
  • 23
  • http://stackoverflow.com/questions/641407/javascript-negative-lookbehind-equivalent And inspired by Jason S answer: http://jsfiddle.net/an8KD/2/ – sinisake Jun 17 '14 at 05:03