I have the following JavaScript RegEx to match functions prefixed by theme-
.
/(theme-([\w-]+))(?:\s*\(\s*)([^)]+?)(?:\s*\))/gm
However, I also need to match other functions as parameters, like theme-foo(param1, theme-bar(arg1)), param3)
, but this RegEx isn't working because it assumes that the closing parentheses of the function being called in a parameter is the closing parentheses of the main function.
How can I do this?