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: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Shen <timshen91 at gmail 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 17:54:27 +0100
- 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>
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc
index a81f517..6a1faaf 100644
--- a/libstdc++-v3/include/bits/regex.tcc
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -70,7 +70,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// without defining a macro. Users should define
// _GLIBCXX_REGEX_USE_THOMPSON_NFA if they need to use this approach.
bool __ret;
- if (!__re._M_automaton->_M_has_backref
+ if (!(__re._M_flags & regex_constants::ECMAScript)
#ifndef _GLIBCXX_REGEX_USE_THOMPSON_NFA
&& __policy == _RegexExecutorPolicy::_S_alternate
#endif
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?