I'd like to remove character between { and }. Example : input_string = 'i like apple {nobody knows}'; expected result : 'i like aple'
Solution 1:
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,'')
Post a Comment for "Javascript Regex To Remove String Inside Bracket"