I have found a regex template in Expresso, this one works fine and returns perfect matches but in JavaScript it doesn't work. I know its may be for look-behind, but I am not enough efficient in Regex to make it JS compatible.
\((?>[^()]+|\((?<number>)|\)(?<-number>))*(?(number)(?!))\)
I want to match it with ...
max(50, max(51, 60)) a() MAX(s,4,455)something
... and it should return ...
1: (50, max(51, 60))
2: ()
3: (s,4,455)
This works perfectly in Expresso but JS console in Chrome says:
Uncaught SyntaxError: Invalid regular expression: /\((?>[^()]+|\((?<number>)|\)(?<-number>))*(?(number)(?!))\)/: Invalid group
How can this regex be modified to function properly in JavaScript?