I want to remove the regex content from my string but it works on the regex site (https://regex101.com/r/XSpa6d/2) but not with my code. What did I do wrong cuz cant seem to find it? (https://jsfiddle.net/eL8r4b1j/)
const string = "random characterhundsguhiosdg window.__AH_DATA__= {gert}\n\n window.__APOLLO_STATE__= {} random characterhundsguhiosdg"
const r = new RegExp(/window\.__AH_DATA__= {.*}\\n\\n window\.__APOLLO_STATE__= {}/gm)
const replaced = string.replace(r, "")
console.log(replaced)
New lines should not be double escaped.
const string = "random characterhundsguhiosdg window.__AH_DATA__= {gert}\n\n window.__APOLLO_STATE__= {} random characterhundsguhiosdg"
const r = new RegExp(/window\.__AH_DATA__= {.*}\n\n window\.__APOLLO_STATE__= {}/gm)
const replaced = string.replace(r, "")
console.log(replaced)