$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
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}?
Lorenzo,
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.
Phil.