fork download
  1.  
  2. s = "Line1.\r\nLine2.\rLine3.\nLine4\r\nLine5"
  3. res = s.gsub(/(\.\R+)|\R+/, '\1')
  4. puts res
  5. puts res.gsub("\r", 'CR').gsub("\n", 'LF')
  6.  
  7.  
Success #stdin #stdout 0s 28688KB
stdin
Standard input is empty
stdout
Line1.
Line2.
Line3.
Line4Line5
Line1.CRLFLine2.CRLine3.LFLine4Line5