0

My string is like:

"Drop Name,Area/zone,Pop,Hub,Gstinnumber\r\nCOCO000007,coco000007,coco000007,KAB STAR,Active,12-04-2017 12:00,\"2A GOUR GHOSH ROAD, KOLKATA-700025\",West Bengal,Kolkata,700025"

and I want to replace this \r\n, with comma (,), so I did like this

a=a.replace('/\\r\\n/g', ' ');

even I tried to do a.split('/\\r\\n/g', ' '); but result is the same, no change.

TankorSmash
  • 12,186
  • 6
  • 68
  • 106

1 Answers1

0

Your issue is that the regex is quoted, so the pattern you are passing a string instead of a regex. Do it without quotes:

a = a.replace(/\r\n/g, ',')