Is it possible? Matching the exact same number of opening & closing braces

前端 未结 1 759
醉话见心
醉话见心 2021-01-15 00:57

I\'m no expert on Regex. I\'m trying to create a regular expression that will match the exact same number of opening and closing braces, but I\'m stumped on how to do it.

1条回答
  •  抹茶落季
    2021-01-15 01:23

    This problem cannot be solved using regular grammar => it cannot be done by regular expression.

    However - from Dirk Vollmar's comment - certain regex engines have extended functionality, e.g. the .NET one, which is capable of matching brackets using so called "balanced group definitions".

    0 讨论(0)
提交回复
热议问题