This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PR 61424] std::regex matches right to left, not leftmost longest
- From: Tim Shen <timshen91 at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 10 Jun 2014 13:56:32 -0700
- Subject: Re: [PR 61424] std::regex matches right to left, not leftmost longest
- Authentication-results: sourceware.org; auth=none
- References: <CAPrifDm1M5RotYKr4GLQ7i_=F8h-37vh2C2HJvrRNaoiXgQirA at mail dot gmail dot com> <20140610165427 dot GM30729 at redhat dot com>
On Tue, Jun 10, 2014 at 9:54 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
> I'm sure this is because I still don't understand all the regex code,
> but doesn't this change mean that for an "extended" mode regex with
> backrefs, the user could define _GLIBCXX_REGEX_USE_THOMPSON_NFA and
> backrefs wouldn't work?
Sorry I missed that basic POSIX (BRE) has back-references (damn!), but
extended POSIX (ERE) doesn't. So it should look like:
- if (!__re._M_automaton->_M_has_backref
+ if (!(__re._M_automaton->_M_has_backref || (__re._M_flags &
regex_constants::ECMAScript))
...and all deleted _M_has_backref lines should be undeleted.
This patch is a temporary (I'm not sure how long though) workaround;
BFS's support for ECMAScript with no back-references shall be done
finally.
--
Regards,
Tim Shen