Boost logo

Boost :

From: Lorenzo Bettini (bettini_at_[hidden])
Date: 2007-05-01 05:41:28

John Maddock wrote:
> Lorenzo Bettini wrote:
>> Hi
>> 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}?
> Probably not what you wanted, but:
> [(\[{]foo[)\]}]

but this would match also {foo] which would wrong...

> sort of does what you want, but if you want to ensure that the brackets
> match up, then it's down to:
> \[foo\]|\(foo\)|\{foo\}

I see, this brings to lots of duplicated code (especially if the inner
part is big...

do you happen to know whether there are any specifications for regular
expressions for matching parenthesis (I mean in any regexp frameworks or


Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)

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