deleting all lines of HTML code between two points

A discussion of how to use EasyPatterns, EasyPattern Helper and using the EasyPattern library.

Moderator: DataMystic Support

wschaepe
Posts: 3
Joined: Sun Aug 24, 2008 9:38 am

deleting all lines of HTML code between two points

Postby wschaepe » Sun Aug 24, 2008 9:59 am

I have HTML files. I am trying t o delete all lines of HTML between two tags,

<div class="printfooter">
.
.
multiple lines of HTML code
NOt all the same in each file
.
.
</body></html>

I want to delete the tag <div class="printfooter"> and everything that follows it except for the last two tags. I want to keep the last two tags on the pages: </body></html>

I had asked about this before and was using NewPP limit report as the starting point. <div class="printfooter"> is the better starting point.

The answer I got was this:
Simon Carter suggested I use the following:
Use the EasyPattern search replace:

NewPP limit report[ 0+ chars ]</script>[ 0+ whitespace ]</body>

Replace with:

</body>

If you have more than 4KB of text in-between, then click the [...] button next to the search/replace type and increase the maximum match size.

But this did not work. When I ran it,the output log said there was no difference between the input and output file.
Attachments
8-23-08- easypattern Filter.jpg
8-23-08- easypattern Filter.jpg (130.42 KiB) Viewed 7571 times

User avatar
DataMystic Support
Site Admin
Posts: 2154
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: deleting all lines of HTML code between two points

Postby DataMystic Support » Sun Aug 24, 2008 9:54 pm

Get rid of the cr/lf after your <div> tag - it is preventing the pattern from matching.

Also, copy some text into the trial run area and test it out there with Prompt On Replace turned on.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

wschaepe
Posts: 3
Joined: Sun Aug 24, 2008 9:38 am

Re: deleting all lines of HTML code between two points

Postby wschaepe » Mon Aug 25, 2008 12:25 am

It still does not seem to work.

I have this for the find EasyPattern: <div class="printfooter">[0+chars]</body>
To be replaced by this: </body>
I made the max match size over 300000.

The output logs says that: 1) either that the output does not appear to be different to input file - deleting (output filter\output only modified files)
or 2) 0 replace(s) performed for pattern match [<div class="printfooter">[0+char]<body>\r\n\r\n]

I have attached the part of the html files that I am trying to eliminate: Everything between <div class="printfooter"> to the end. I want the printfooter eliminated and want to add back in the ending tags of body and html, if they are deleted.

Regards,
Bill

wschaepe
Posts: 3
Joined: Sun Aug 24, 2008 9:38 am

Re: deleting all lines of HTML code between two points

Postby wschaepe » Mon Aug 25, 2008 5:09 am

Problem Solved.

:D I have it working now. Maybe the difference is that in EasyPattern, I typed the pattern into the box rather than cut and pasted it.

On the HTML files, I want to delete everything between <div class="printfooter">[0+char]</body> and then replace it with </body>.

I checked the output and all code between <div class="printfooter"> and </body> is gone!!! Maybe by cutting and pasting, i was sticking in CR/LF's and not knowing it.

Thank you for your help.

Regards,
Bill Schaepe

User avatar
DataMystic Support
Site Admin
Posts: 2154
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: deleting all lines of HTML code between two points

Postby DataMystic Support » Mon Aug 25, 2008 9:44 am

You were - you can see in your log below that your search/replace had 2 extra lines after it

2) 0 replace(s) performed for pattern match [<div class="printfooter">[0+char]<body>\r\n\r\n]


Glad it's working now!
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “EasyPatterns Support”

Who is online

Users browsing this forum: No registered users and 1 guest