Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-04-26 12:29:36


John Maddock wrote:
> Lorenzo Bettini wrote:
>> Hi
>>
>> is there any plan to support more than 9 back references in the regex
>> library?
>
> You can have as many marked sub-expressions as you want, and refer to them
> in the match_results structure once you have a match. What you can't do at
> present is have a true back-reference say \12 in your expression. This is
> basically a problem with the regex syntax, so if you know of a good syntax
> extension that's already in use then it would trivial to support this.

You could use xpressive, which handles this case. Any \ddd where d is a
decimal digit is interpreted as a back-reference if

- The backreference number is less than 10
-OR-
- The backreference number is less than or equal to the number of
capturing groups seen so far.

I believe that's perl's rule.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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