Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2007-05-01 05:59:51


Lorenzo Bettini wrote:
> do you happen to know whether there are any specifications for regular
> expressions for matching parenthesis (I mean in any regexp frameworks
> or libraries)?

Not really no, but I have another idea, assuming the x-modifier is on:

(?x)
(?:
  (\()
  |(\[)
  |(\{)
)
foo
(?:
  (?(1)\)
  |(?:(?(2)\]
  |(?:\}
))))

The idea is to use conditional expressions to check which opening backet
matched and then react accordingly. You'll need to check I've got the ('s
and )'s matching up 'cos I lost count while typing in :-(

HTH, John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk