[PR 61424] std::regex matches right to left, not leftmost longest
Tim Shen
timshen91@gmail.com
Tue Jun 10 20:56:00 GMT 2014
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
More information about the Libstdc++
mailing list