* Regexp for matching a symbol (identifier) in emacs-lisp
@ 2008-10-10 11:33 Nordlöw
2008-10-10 15:19 ` Lennart Borgman (gmail)
2008-10-10 15:47 ` Nikolaj Schumacher
0 siblings, 2 replies; 5+ messages in thread
From: Nordlöw @ 2008-10-10 11:33 UTC (permalink / raw
To: help-gnu-emacs
Does Emacs provide a shorter way of matching an emacs-lisp symbol
(identifier) than the following:
"\\(" "\\(?:" "\\w\\|\\s_" "\\)+" "\\)"
Thanks in advance,
Nordlöw
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Regexp for matching a symbol (identifier) in emacs-lisp
2008-10-10 11:33 Regexp for matching a symbol (identifier) in emacs-lisp Nordlöw
@ 2008-10-10 15:19 ` Lennart Borgman (gmail)
2008-10-10 18:22 ` Nikolaj Schumacher
2008-10-10 15:47 ` Nikolaj Schumacher
1 sibling, 1 reply; 5+ messages in thread
From: Lennart Borgman (gmail) @ 2008-10-10 15:19 UTC (permalink / raw
To: Nordlöw; +Cc: help-gnu-emacs
Nordlöw wrote:
> Does Emacs provide a shorter way of matching an emacs-lisp symbol
> (identifier) than the following:
> "\\(" "\\(?:" "\\w\\|\\s_" "\\)+" "\\)"
You mean the concatenation of those strings? (BTW, if you want to make
it easier to read then rx is an alternative.)
You do not need two level of parenthesis. Use either the shy group or
the submatch group type parenthesis.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Regexp for matching a symbol (identifier) in emacs-lisp
2008-10-10 15:19 ` Lennart Borgman (gmail)
@ 2008-10-10 18:22 ` Nikolaj Schumacher
2008-10-10 18:25 ` Lennart Borgman
0 siblings, 1 reply; 5+ messages in thread
From: Nikolaj Schumacher @ 2008-10-10 18:22 UTC (permalink / raw
To: Lennart Borgman (gmail); +Cc: help-gnu-emacs, Nordlöw
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> wrote:
> Nordlöw wrote:
>> Does Emacs provide a shorter way of matching an emacs-lisp symbol
>> (identifier) than the following:
>> "\\(" "\\(?:" "\\w\\|\\s_" "\\)+" "\\)"
>
>
> You do not need two level of parenthesis. Use either the shy group or
> the submatch group type parenthesis.
He needs two if he wants to match the entire symbol in a matching group,
though.
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Regexp for matching a symbol (identifier) in emacs-lisp
2008-10-10 18:22 ` Nikolaj Schumacher
@ 2008-10-10 18:25 ` Lennart Borgman
0 siblings, 0 replies; 5+ messages in thread
From: Lennart Borgman @ 2008-10-10 18:25 UTC (permalink / raw
To: Nikolaj Schumacher; +Cc: help-gnu-emacs, Nordlöw
On Fri, Oct 10, 2008 at 8:22 PM, Nikolaj Schumacher <me@nschum.de> wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> wrote:
>
>> Nordlöw wrote:
>>> Does Emacs provide a shorter way of matching an emacs-lisp symbol
>>> (identifier) than the following:
>>> "\\(" "\\(?:" "\\w\\|\\s_" "\\)+" "\\)"
>>
>>
>> You do not need two level of parenthesis. Use either the shy group or
>> the submatch group type parenthesis.
>
> He needs two if he wants to match the entire symbol in a matching group,
> though.
Yes, my bad.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Regexp for matching a symbol (identifier) in emacs-lisp
2008-10-10 11:33 Regexp for matching a symbol (identifier) in emacs-lisp Nordlöw
2008-10-10 15:19 ` Lennart Borgman (gmail)
@ 2008-10-10 15:47 ` Nikolaj Schumacher
1 sibling, 0 replies; 5+ messages in thread
From: Nikolaj Schumacher @ 2008-10-10 15:47 UTC (permalink / raw
To: Nordlöw; +Cc: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> wrote:
> Does Emacs provide a shorter way of matching an emacs-lisp symbol
> (identifier) than the following:
> "\\(" "\\(?:" "\\w\\|\\s_" "\\)+" "\\)"
I don't think so. In fact, you should also add \\_< and \\_>, so it
doesn't match half symbols.
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-10 18:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-10 11:33 Regexp for matching a symbol (identifier) in emacs-lisp Nordlöw
2008-10-10 15:19 ` Lennart Borgman (gmail)
2008-10-10 18:22 ` Nikolaj Schumacher
2008-10-10 18:25 ` Lennart Borgman
2008-10-10 15:47 ` Nikolaj Schumacher
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.