I'm terrible with Regex, can't find a suitable answer on Stack which works for this.
I have a string like this:
var str = 'abc?def%3f999%3F^%&$*'
I only want to remove the following:
?, %3f and %3F (the entity codes for question marks)
I've tried this:
var theQuery = str.replace([\\?]|\\%3f|\\%3F,'');
But this doesn't appear to be valid regex. What's a solution that will work here?
You can use this:
var str = 'abc?def%3f999%3F^%&$*'
var theQuery = str.replace(/\?|%3f/gi, '');
//=> abcdef999^%&$*
/ and /g%If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With