[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Newbie regexp question
From: |
Friedrich Dominicus |
Subject: |
Re: Newbie regexp question |
Date: |
30 Oct 2002 18:19:21 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) |
Paul Cohen <paco@enea.se> writes:
>
> No that's not what I want. Let me rephrase in more general terms. I want to
> remove a number of character sequences for which the following
> holds:
well it was not clear to me that you want to cut the lines between the
tags. So doing you stuff is still not too difficult.
Search for the beginning Tags
save positon
Search for the closing Tag
remove the region between the saved positoin and point
In Emacs Lisp:
(defun remove-text-between (start-tag end-tag)
(interactive "sStart Tag: \nsEnd Tag: \n")
(search-forward start-tag)
(forward-line)
(let ((start (point)))
(search-forward end-tag)
(forward-line -1)
(delete-region start (point))))
I assume that the Tags are on a line of their own.
<!-- Test -->
If you are not fully sure about the names, you might try regular
expressions. Under the given circumstances are REGEXP IMHO
overkill. If you know your data you should pull out the information
for you needs.
It's easy to extend. if you want to let it run on the whole buffer,
but I leave this to you.
Regards
Friedrich
Re: Newbie regexp question, Barry Margolin, 2002/10/30
Re: Newbie regexp question, Stefan Monnier <address@hidden>, 2002/10/30
Re: Newbie regexp question, kgold, 2002/10/31