Every article or question I've seen pretty much says, just use:
str.replace(/yourstring/g, 'whatever');
But I want to use a variable in place of "yourstring". Then people say, just use new RegExp(yourvar, 'g'). The problem with that is that yourvar may contain special characters, and I don't want it to be treated like a regex.
So how do we do this properly?
Example input:
'a.b.'.replaceAll('.','x')
Desired output:
'axbx'
"ABc34*\d/4h"you want to work with/replace?string.replacedoes.'a.b.c'.split('.').join('x')