I need to, in javascript, get the text inside of the parentheses. The rest is garbage. I know how to match the text with a regex, but not find it for use in .replace();
Perhaps there is a better method then .replace for this? Any help would be greatly appreciated.
I guess I could use match
txt = string.match('/\(.*?\)/');
Although that regex returns null
That code snippet isn't working as you expect because the forward slashes are used literally because it's a string, so it's silently being converted to a regexp object.
I might do it like this: (the join, replace, and split method calls are to remove the parentheses.)