all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Heime <heimeborgia@protonmail.com>
Cc: "'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Regexp for matching (defun lines
Date: Thu, 1 Aug 2024 03:34:33 +0000	[thread overview]
Message-ID: <DS7PR10MB52328F4A06EC628A497E548DF3B22@DS7PR10MB5232.namprd10.prod.outlook.com> (raw)
In-Reply-To: <VC8UhGjZxC1RH8ZaU4c3B2m0KkjTDtaHvUh7SkCL11AHYPTg7b5ivcQO3jPUvuqBcPM6kbLgV-KSmF7Sc11gXC3NTuq8HVGCPSN5Iea7xFU=@protonmail.com>

> > > > > > (concat
> > > > > > "^\\s-("
> > > > > > (regexp-opt...)
> > > > > > t)
> > > > > > "\\s-+\\(\\(\\sw\\|\\s_\\)+\\)")
> > > > >
> > > > > I see that you use "\\sw". What is the advantage verses
> "[[:alnum:]-
> > > > > _]"
> > > >
> > > > No special advantage. You can include any other
> > > > chars you want, so you can pick up, e.g.,
> > > >
> > > > (defun foo!@$%^&*+={}/:42<>? ()
> > > > (message "Hello"))
> > > >
> > > > Perfectly legitimate, and none of those chars
> > > > even require escaping.
> > >
> > > Meaning that \\sw is superior to [[:alnum:]-_], right ?
> >
> >
> > No.
> >
> > \\sw means word-char syntax.
> > [[:alnum:]-_] means alphanumeric- or symbol-char syntax.
> 
> \sw is equivalent to "[:word:]", that includes digits.  And [:alnum:]
> is alphabetic and numeric.  What is the difference ?

https://www.gnu.org/software/emacs/manual/html_node/elisp/Char-Classes.html

says:

‘[:alnum:]’
     This matches any letter or digit.  For multibyte characters, it
     matches characters whose Unicode ‘general-category’ property (*note
     Character Properties::) indicates they are alphabetic or decimal
     number characters.

The same is not said for [:word:].

  reply	other threads:[~2024-08-01  3:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 19:23 Regexp for matching (defun lines Heime
2024-07-31 19:59 ` [External] : " Drew Adams
2024-07-31 20:14   ` Heime
2024-07-31 21:02     ` Drew Adams
2024-07-31 21:15       ` Heime
2024-08-01  2:11         ` Drew Adams
2024-07-31 21:29       ` Heime
2024-08-01  2:08         ` Drew Adams
2024-08-01  2:24           ` Heime
2024-08-01  3:34             ` Drew Adams [this message]
2024-08-01  4:15               ` Heime

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=DS7PR10MB52328F4A06EC628A497E548DF3B22@DS7PR10MB5232.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=heimeborgia@protonmail.com \
    --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.