all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* I need help with a regular expression
@ 2010-04-16 21:25 Cecil Westerhof
  2010-04-16 22:16 ` José A. Romero L.
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Cecil Westerhof @ 2010-04-16 21:25 UTC (permalink / raw)
  To: help-gnu-emacs

I have written some code to count the number of functions in a buffer.
At the moment I use the following regular expression for this:
    "^(defun "

This works fine, but then the defun's have to be on the start of the
line. This is the most logical, but it is better to be save as sorry.
This is why I wanted to write a more robust regular expression. I was
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?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-05-06 10:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-16 21:25 I need help with a regular expression Cecil Westerhof
2010-04-16 22:16 ` José A. Romero L.
2010-04-17  6:20   ` Cecil Westerhof
2010-05-04 21:21   ` Lennart Borgman
2010-05-05 15:51 ` J. David Boyd
     [not found] ` <mailman.7.1273074686.2155.help-gnu-emacs@gnu.org>
2010-05-06 10:17   ` Xah Lee

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.