[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
- Difference between \\w and [:word:]?, Eric Abrahamsen, 2018/06/07
- Re: Difference between \\w and [:word:]?, Ben Bacarisse, 2018/06/07
- Re: Difference between \\w and [:word:]?, Eric Abrahamsen, 2018/06/07
- Re: Difference between \\w and [:word:]?, Robert Pluim, 2018/06/08
- Re: Difference between \\w and [:word:]?, Yuri Khan, 2018/06/08
- Re: Difference between \\w and [:word:]?, Eric Abrahamsen, 2018/06/08
- Re: Difference between \\w and [:word:]?, Stefan Monnier, 2018/06/09
- Re: Difference between \\w and [:word:]?, Eric Abrahamsen, 2018/06/09