I’m trying to remove all type casts from a js file.
The current (not-working) regex I have is:
/(?!new\s+&?!function\s+)\w+\((.+)\)/gi
Basically I want anything like Class(var) but not new Class(arg) or function Func(arg)
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
produces
but will only match correctly if there are no nested parentheses in the actual parameter list. To generally match a function call is not possible using regular expressions since regular grammars can’t handled nested parenthetical groups.