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

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

Re: I need help with a regular expression


From: José A . Romero L .
Subject: Re: I need help with a regular expression
Date: Tue, 04 May 2010 15:44:51 -0000
User-agent: G2/1.0

On 16 Kwi, 23:25, Cecil Westerhof <Ce...@decebal.nl> wrote:
(...)
> thinking about something like:
>     "^[^;]+(defun "
>
> But that does not work. It marks the following completely, instead of
> the three at its own:
>     (defun a () (message "a"))
>     (defun b () (message "b"))
>     (defun c () (message "c"))
>
> Why is this? And how can I make a regular expression that does what I
> want?

Because  emacs  regular expressions are by default multi-line? All in
all an emacs buffer is just a very long stream of characters, so this
approach makes sense, I guess.

Try this instead: "^[^;\n]*(defun " - and remember: regexp-builder is
your friend ;-)

Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)


reply via email to

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