Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138134

how to use replace() method for a string just one time instead of mutliple times?

$
0
0

str is an html string (or string that contains the full html) but with some unwanted codes in between that I tried to get rid off.

This is what worked for me so far:

const contentClean = str.replace(/=0A/gm,"").replace(/(=09)/gm,"").replace(/(=\r\n)/gm,"").replace(/(3D)/gm,"");

How do I write the replace() method just one time instead of 4 times in the code above?


Viewing all articles
Browse latest Browse all 138134

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>