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

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

Re: Newbie regexp question


From: Paul Cohen
Subject: Re: Newbie regexp question
Date: Wed, 30 Oct 2002 16:46:41 GMT

Hi Fridrich,

Friedrich Dominicus wrote:

> Paul Cohen <address@hidden> writes:
> > I want to do a Emacs regexp search and replace on a HTML file containing
> > patterns like this:
> >
> > <!--Test-->
> > ...
> > <!--End of Test-->
> >
> > Where "..." denotes a variable number of lines of HTML text.
> >
> > I want to search for all occurrences of the above pattern and then
> > remove them from the HTML file!
> >
> > I've tried a number of variants without any success. For example the
> > following regexp doesn't work:
> >
> > <!--Test-->\(.*\n\)*<!--End of Test-->
> I would restate the problem. It does not make much sense to me to
> match over a bunch of lines you do not want to handle.
>
> So how about
> M-C-% ^[ \t]*<!--.*Test.*--> with: RET

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:

1) They run over multiple lines.
2) They begin and end with well defined sequences of characters. (In my case
with "<!--Test-->"  and "<!--End of Test-->"). Let's call the delimiting
character sequences for the start and and end token.
3) They may contain any number of unknown (printable) characters between the
start and end token.
4) There may exist multiple instances of these character sequences in the
file.

/Paul



reply via email to

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