all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Difference between \\w and [:word:]?
Date: Thu, 07 Jun 2018 14:35:42 -0700	[thread overview]
Message-ID: <87lgbqqnyp.fsf@ericabrahamsen.net> (raw)
In-Reply-To: 87y3fq5orf.fsf@gmail.com

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	other threads:[~2018-06-07 21:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 19:18 Difference between \\w and [:word:]? Eric Abrahamsen
2018-06-07 20:24 ` Robert Pluim
2018-06-07 21:35   ` Eric Abrahamsen [this message]
     [not found] <mailman.1434.1528399150.1292.help-gnu-emacs@gnu.org>
2018-06-07 23:00 ` Ben Bacarisse
2018-06-08  2:29   ` Eric Abrahamsen
2018-06-08  9:16     ` Robert Pluim
2018-06-08  9:24       ` Yuri Khan
2018-06-08 15:05         ` Eric Abrahamsen
2018-06-09 23:36           ` Stefan Monnier
2018-06-10  2:05             ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgbqqnyp.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.