<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/135048>135048</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc++] `<regex>`: `\00` should be rejected
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Alcaro
</td>
</tr>
</table>
<pre>
```c++
#include <regex>
#include <stdio.h>
int main() {
try {
std::regex r{"\\00"};
puts("valid");
} catch (const std::exception& e) {
printf("not valid: %s\n", e.what());
}
try {
std::regex r{"\\01"};
puts("valid");
} catch (const std::exception& e) {
printf("not valid: %s\n", e.what());
}
}
```
Expected: Reject them. 00 and 01 do not match DecimalIntegerLiteral in the JS spec, and lookahead can't be a digit either.
Actual: Both are valid. (Can't find what they're actually parsed as, though.)
https://godbolt.org/z/heM1o1aGe (MS-STL is busy fixing it https://github.com/microsoft/STL/pull/5380)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUVMGOozgQ_ZriUmpkCgjJgQOdDKtd9Vy25weMXYB3HRzZprezX78yyaizM1LfJ7ICpvzeq1cUJUMw08LcQv0M9SmTa5ydbzurpHfZ4PS1hZ24LQX0nJbogEqzKLtqRiiPnid-h_LLT4EQtXH5fA-JziwRz9IsQHugA0KTuBARo78-7NIvRA1lB2W3kaNPUSKoj1AfhUi3zQnKR8RljWEjpjdpjU5H6PBxBJoTKhnVjEB75ZYQPzT4XfElGrcA7ZD_n9pG7c0Sxxv54iLeBMoOgeoA9XHZxI7I-T-zjDd3P4r_7PRTi8UvZfHm7_7_vV1AdF_eL6wib0R_8l-sIsaZzzkKgXLRKArUDpPeecv7xMqcpf19iTyxfzGRvbRoloTCP14xXFilLBLWOve3nFlqVHIBaiIOjBK1mUxENnFmn4PoOhVXaVMCzy7OKD3fvOWpSMc7cjSLxmQsCV2BGs8oN6C94kX6wBplSMpxdus058n61tJzjJeQSkw9UD85PTgbc-cnoP5foH7mr4Ur5G-c5L6-Pr1-e0ETcFjDFUfzbpYJTcQfWEyc1yFX7gzUn43yLrgxAvWv316A-stqLVBfl3sBdMh0W-pDeZAZt0VTVVQ0NRXZ3NK-HBreD7LUo9rvhkpXutqVu1KOjeSGMtOSoFpU4lDsahIi15rGSh3qYRyprklBJfgsjc2tfTsnT5kJYeW2KGtR7TMrB7ZhGxxE1gzfx0Pq4VPm24R6GtYpQCWsCTF88EQT7TZyHmD1CVPTPIyTtOu2h9s3vxMYZrdanV6037qJdbZ6235SviR5vzxdvEsgoH7zEYD6u5W3lv4LAAD__1c2ciE">