I'd like to remove character between {
and }
.
Example :
input_string = "i like apple {nobody knows}";
expected result :
"i like aple"
You can use
var out = input_string.replace(/{[^}]*}/,'')
If you want to remove more than one occurrence, use
var out = input_string.replace(/{[^}]*}/g,'')
To remove things between /*
and */
, this one should work :
var out = input_string.replace(/(?!<\")\/\*[^\*]+\*\/(?!\")/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