Method:
string.replace(new RegExp(oldString,"gm"),newString))
gm respectively represents:
g=global, m=multiLine
Generally the method is like this Yes, you can replace all specified strings
Another simple method to verify JS:
Enter in the browser address bar
javascript:alert("abcabcabc".replace(new RegExp("a","gm"),"ad"))
This is easier;), I wonder if multiple lines will be convenient