This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/77469] std::regex x("[b\\-a]") throws with message "Invalid range in bracket expression."
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Sep 2016 09:33:54 +0000
- Subject: [Bug libstdc++/77469] std::regex x("[b\\-a]") throws with message "Invalid range in bracket expression."
- Auto-submitted: auto-generated
- References: <bug-77469-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77469
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #4)
> \ is not special inside bracket expressions, [b\-a] means b and the range
> between \ and a. If you want to include a - in a bracket expression, put it
> first or last.
That's true for POSIX BREs and EREs, but for ECMAScript escaping the dash
should work (and does on trunk).