[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I need help with a regular expression
From: |
Cecil Westerhof |
Subject: |
I need help with a regular expression |
Date: |
Tue, 04 May 2010 15:44:50 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
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
- I need help with a regular expression,
Cecil Westerhof <=