[PATCH][libcxx] regex/awk does not handle 3-char octal escapes correctly
Howard Hinnant
hhinnant at apple.com
Tue Jul 2 10:45:51 PDT 2013
Committed revision 185449.
Thanks!
Howard
On Jun 28, 2013, at 8:31 PM, William Fisher <william.w.fisher at gmail.com> wrote:
> This patch fixes a bug where the regex parser doesn't advance the pointer after reading the third character of an octal escape (in awk mode).
>
> That is, regex{"\\141", awk} results in the regular expression /a1/ instead of just /a/.
>
> Here is the test case:
>
> ```
> #include <regex>
> #include <cassert>
>
> int main()
> {
> using std::regex_constants::awk;
>
> assert(std::regex_match("\4", std::regex{"\\4", awk}));
> assert(std::regex_match("\41", std::regex{"\\41", awk}));
> assert(std::regex_match("\141", std::regex{"\\141", awk}));
> assert(std::regex_match("\1411", std::regex{"\\1411", awk}));
> }
> ```
>
> Thanks.
>
> <octal_escape.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list