.net - How to build a regular expression for nested search conditions -
i need build regular expression matching this:
"pqr , xyz or(abc or lmn)"
please me achieve this!
it impossible regular expressions correctly match nesting.
that, need context-free grammar.i see in comment, mentioned using .net.
"regular expression" library in .net more powerful people call "regular expressions" in computer science.it is possible use .net regexes match nested parentheses using balancing-group definitions:
\( (?> [^()]+ | (?<depth>\() | (?<-depth>\)) )* (?(depth)(?!)) \)
for pattern work you'll need ignore whitespaces.
Comments
Post a Comment