help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Difference between \\w and [:word:]?


From: Eric Abrahamsen
Subject: Re: Difference between \\w and [:word:]?
Date: Thu, 07 Jun 2018 14:35:42 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Robert Pluim <rpluim@gmail.com> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Can someone explain to me what's happening here? What's the difference
>> between \\w and [:word:], inside and outside of a bracket construction?
>>
>> (setq case-fold-search nil)
>> (string-match-p "[:word:]" "P") => nil
>> (string-match-p "[[:word:]]" "P") => 0
>> (string-match-p "\\w" "P") => 0
>> (string-match-p "[\\w]" "P") = nil
>
> Consider
>
> (string-match-p "[\\w]" "w") => ?

Oh, ha.

(string-match-p "[\\w]" "\\") => 0

And my other confusion (about character classes) was cleared up by
reading the manual more carefully.

Thanks,
Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]