[cfe-dev] Bug in libc++
Aleksandr via cfe-dev
cfe-dev at lists.llvm.org
Fri Aug 25 11:38:03 PDT 2017
Hi, Tim.
This is wrong. [\W] and [^\W] should be valid expressions. User of
libc++ doesn't how it implemented, "\W" will be replaced [^_[:alnum:]]
or vice versa. It should works in any way. Regex [^\W] work in the most
standart tools. I didn't read standard of ECMAScript, but I am sure,
that [^\W] will be valid according to it. Maybe I an wrong, so say me,
that ECMAScript doesn't allow this. But explanation, that you give, say
me, that this is problem only implementation libc++. Maybe is should be
implemented in another way, not just define \W as ^_[:alnum:].
On 21.08.2017 18:19, Tim Northover wrote:
> Hi Aleksandr,
>
> On 21 August 2017 at 06:54, Aleksandr via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
>> std::regex RE("[^\\W]");
>
> I think libc++ is correct. C++11 defines \W as being equivalent to
> [^_[:alnum:]], which means your regex is "[^[^_[:alnum:]]]". I believe
> that'll be parsed as "some weird character followed by ]]".
>
> Cheers.
>
> Tim.
>
>
>
More information about the cfe-dev
mailing list