Regex To Search for Nested Brackets [duplicate]
Possible Duplicate:
Can regular exp开发者_开发问答ressions be used to match nested patterns?
How do I use regular expressions to search for a pair of opening and closing brackets with arbitrary number of nested brackets inside it e.g.
(...(...(...(...) ...) ...) ...)
Each opening bracket must be matched by a closing bracket. And the number of nested opening-closing pair is arbitrary. Other alphanumeric characters may appear inside the brackets.
If you really want to use RegEx to do it(i'm not sure it's the good way),
you can loop until this regex \([^\(\)]*\)
returns nothing,
and for each times you get something you have to remove the result in the initial and loop again...
精彩评论