w.r.t. [Bug libstdc++/85472] Regex match bug

Hans Åberg haberg-1@telia.com
Thu May 3 19:04:00 GMT 2018



> On 3 May 2018, at 20:42, Tim Shen <timshen91@gmail.com> wrote:
> 
> On Thu, May 3, 2018 at 11:27 AM Hans Åberg <haberg-1@telia.com> wrote:
>> Do you have a better description on how it is supposed to work.
> Specifically, how do you get only an even number in this case?
> 
> Quoting [1]: When a backreference \N appears as an Atom, it matches the
> same substring as what is currently stored in the N'th element of the
> submatch array.
> 
> Therefore \1 always matches and only matches what (a+) captured. With the
> input "aaaa", it's possible that (a+) captures "aa", and therefore \1
> matches the rest "aa". With the input "aaa", this is not possible.

So in other words, it means that the string that the first regex group should be used as a dynamic change of the regex itself? So in the example at the top of [1], axaxa is a match, but not axbxc?

1. https://www.regular-expressions.info/backref.html




More information about the Libstdc++ mailing list