javascript - JS regex remove typecasts -


i'm trying remove type casts js file.

the current (not-working) regex have is:

/(?!new\s+&?!function\s+)\w+\((.+)\)/gi 

basically want class(var) not new class(arg) or function func(arg)

thanks!

 s = "basically want class(var) not new class(arg) or function func(arg)"  re = /(?:(?!new|function)\b\s+|^|[^\w\s])\s*\b([a-z]\w*\s*\(.*?\))/g  (var match; (match = re.exec(s));) { alert(match[1]); } 

produces

 class(var) 

but match correctly if there no nested parentheses in actual parameter list. match function call not possible using regular expressions since regular grammars can't handled nested parenthetical groups.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -