Boost logo

Boost :

From: Lorenzo Bettini (bettini_at_[hidden])
Date: 2007-05-01 11:37:50

Paul Giaccone wrote:
> Lorenzo Bettini wrote:
>> 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...
> You could use Spirit, of course, using a function that recorded which
> type of bracket (pedantic point: "(", "), "[", "]", "{" and "}" are all
> brackets, but only "(" and ")" are parentheses) was found first and

yes, sorry: in Italian they're all called parentheses :-)

> I'd suggest seeing if anyone else comes up with a solution using regex,
> and writing your own simple parser by hand (not using Spirit) if not.

I heard about Spirit, and I'll probably take a look at it...


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