Boost logo

Boost :

From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2007-05-01 10:16:59

Lorenzo wrote:
> is there a way to specify open and closed parenthesis with a
> regular expression syntax? For instance, if I'd want to specify a
> single regular expression that matches both (foo) and [foo] and {foo}?


Matching parentheses to arbitrary depth is, like matching palindromes,
a textbook example of something that cannot be done with a regular
language and instead needs a context-free language. Google for
"chomsky hierarchy palindrome" for some background material. Of
course, it's possible that some regexp library somewhere has a hack to
add this functionality. But fundamentally, you need a more
sophisticated parser.


Boost list run by bdawes at, gregod at, cpdaniel at, john at