Hi,
Using some extensions provided by .net, one can find groups of parenthesis by using something like this:
^(\w+)\(((?>[^()]+|\((?<D>)|\)(?<-D>))*(?(D)(?!)))\)(.*)$
This will match the following:
Func(innerfunction(arg)).DoSomething()
With the following groups:
- Group 1: Func
- Group 2: innerfunction(arg)
- Group 3: .DoSomething()
My question is, how do I match commas, taking into account if they are or not inside a parenthesis group? For example, a regex to evaluate:
Func(innerFunction(arg1, arg2), arg3).DoSomething()
Should yield:
- Group 1: Func
- Group 2: innerFunction(arg1, arg2)
- Group 3: arg3
- Group 4: .DoSomething()
Thanks.