Skip to content

Commit 2855a30

Browse files
committed
[regex] fix uncaught exception when string is like "\\_"
fixes #129062
1 parent a955426 commit 2855a30

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

libcxx/include/regex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3954,7 +3954,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape(
39543954
++__first;
39553955
break;
39563956
default:
3957-
if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum)) {
3957+
if (!__traits_.isctype(*__first, ctype_base::alnum)) {
39583958
if (__str)
39593959
*__str = *__first;
39603960
else

libcxx/test/std/re/re.regex/re.regex.construct/ptr.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ int main(int, char**)
3131
test("\\(a[bc]\\)", 0);
3232
test("\\(a\\([bc]\\)\\)", 0);
3333
test("(a([bc]))", 2);
34+
test("\\$\\_se", 0);
3435

3536
return 0;
3637
}

0 commit comments

Comments
 (0)