[regex] number of back references

Hi is there any plan to support more than 9 back references in the regex library? thanks in advance cheers Lorenzo -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net

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. John.

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
yes I'm already using this
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
and that's what I'd need: I need to build a long regex made up by many alternatives (each of one is a subexpression), and thus, I reach the back-reference limitation quite easily.
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.
actually, I've only read by googling that there are some regular expression libraries providing more than 9 subexpressions, but I saw no pointer to such libraries. thanks Lorenzo -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net

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

Eric Niebler wrote:
John Maddock 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
Lorenzo Bettini wrote: 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.
OK, thanks, I'll take a look at it... is xpressive compatible with boost::regex expressions? Lorenzo -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net

Lorenzo Bettini wrote:
Eric Niebler wrote:
John Maddock 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
Lorenzo Bettini wrote: present is have a true back-reference say \12 in your expression.
You could use xpressive, which handles this case.
OK, thanks, I'll take a look at it... is xpressive compatible with boost::regex expressions?
Boost.Regex and Boost.Xpressive accept the same basic regex syntax. Xpressive doesn't yet support collating elements (eg., [.ae.]) and equivalence classes (eg., [=a=]). I should also say that as a result of your inquiry, I found an off-by-one error in Xpressive's handling of back-references over 9. If you want to access back-ref \12, you'll need 13 captures in your expression. Darn. It might be too late to fix for 1.34, but I'll patch the archive in the Vault. It's already fixed in HEAD. -- Eric Niebler Boost Consulting www.boost-consulting.com

Eric Niebler wrote:
Lorenzo Bettini wrote:
Eric Niebler wrote:
John Maddock 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
Lorenzo Bettini wrote: present is have a true back-reference say \12 in your expression. You could use xpressive, which handles this case. OK, thanks, I'll take a look at it... is xpressive compatible with boost::regex expressions?
Boost.Regex and Boost.Xpressive accept the same basic regex syntax. Xpressive doesn't yet support collating elements (eg., [.ae.]) and equivalence classes (eg., [=a=]).
OK, thanks... probably I wouldn't need these features at the moment... by the way, I use regular expressions for this http://www.gnu.org/software/src-highlite
I should also say that as a result of your inquiry, I found an off-by-one error in Xpressive's handling of back-references over 9. If you want to access back-ref \12, you'll need 13 captures in your expression. Darn. It might be too late to fix for 1.34, but I'll patch the archive in the Vault. It's already fixed in HEAD.
by the way, I noticed that I don't have any debian boost package for xpressive... it's been part of boost since when? is it made only of headers, or also of a library? thanks again Lorenzo -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net

Lorenzo Bettini wrote:
by the way, I noticed that I don't have any debian boost package for xpressive... it's been part of boost since when?
is it made only of headers, or also of a library?
Header only. It wasn't in 1.33.1 but it will be in 1.34 (any day now) and is available for 1.33.1 as a separate download here: http://boost-consulting.com/vault/index.php?directory=Strings%20-%20Text%20Processing& -- Eric Niebler Boost Consulting www.boost-consulting.com

Eric Niebler wrote:
Lorenzo Bettini wrote:
by the way, I noticed that I don't have any debian boost package for xpressive... it's been part of boost since when?
is it made only of headers, or also of a library?
Header only. It wasn't in 1.33.1 but it will be in 1.34 (any day now) and is available for 1.33.1 as a separate download here:
http://boost-consulting.com/vault/index.php?directory=Strings%20-%20Text%20Processing&
OK, thanks a lot! I'll surely give it a try Lorenzo -- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
participants (3)
-
Eric Niebler
-
John Maddock
-
Lorenzo Bettini