Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GREP Pattern help wanted

3 views
Skip to first unread message

patricia...@gmail.com

unread,
Dec 20, 2015, 2:39:17 AM12/20/15
to
I have lots of html pages where I want to delete completely a certain section of markup, which does a similar (unwanted) job on all the pages but all slightly different in content, both the number of lines and the numerals mainly. On all the pages, the bits I want removed completely are after a common to all pages opening element that is ID'd and another common to all pages closing element. Think <div id="unusual"> ...stuff...</div>, the dots and stuff not being the same on all pages. What pattern would eliminate the ...stuff... ? I can easily make the closing of the div unique in a prior operation if that helps. My find and replace usefully allows grep patterns.

Philip Herlihy

unread,
Dec 20, 2015, 9:55:00 AM12/20/15
to
In article <8be922e3-0997-432a...@googlegroups.com>,
patricia...@gmail.com says...
>
> I have lots of html pages where I want to delete completely a certain section of markup, which does a similar (unwanted) job on all the pages but all slightly different in content, both the number of lines and the numerals mainly. On all the pages, the bits I want removed completely are after a common to all pages opening element that is ID'd and another common to all pages closing element. Think <div id="unusual"> ...stuff...</div>, the dots and stuff not being the
same on all pages. What pattern would eliminate the ...stuff... ? I can easily make the closing of the div unique in a prior operation if that helps. My find and replace usefully allows grep patterns.

Depends on your editor. Some implementations of the Unix Vi editor
allow matching of newlines, and some don't. Dreamweaver's regular
expression capability does. And there's always a balance between the
time it takes to get an expression right, and the time it would take,
with the radio on and a pot of coffee, simply to search for and edit out
the unwanted code.

If you want an easy and quick fix, you might consider changing the div's
ID from "unusual" to "ObsoleteDivToBeDeleted", and use this CSS:

div#ObsoleteDivToBeDeleted {display:none}

--

Phil, London

tlvp

unread,
Dec 20, 2015, 2:35:33 PM12/20/15
to
On Sun, 20 Dec 2015 14:54:58 -0000, Philip Herlihy wrote:

> div#ObsoleteDivToBeDeleted {display:none}

Philip, I love it: the moral equivalent of non-destructive deletion :-) !

Cheers, -- tlvp
--
Avant de repondre, jeter la poubelle, SVP.
0 new messages