Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-15-2005, 03:01 PM   #1
nibbi
Confirmed User
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 104
Regular Expression Help

I need to remove style content code from within <td> tags on hundreds of html pages. I figure the easiest way to do this would be a regular expression and a text editor.

So, anyone here know how to write a regular expression to turn this...

<td height="15" class="xl24" style="height:11.25pt">

Into this...

<td>

Thanks
__________________
http://www.xRag.com
nibbi is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:08 PM   #2
Lycanthrope
Confirmed User
 
Lycanthrope's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: Wisconsin
Posts: 4,517
Maybe this can help you: http://www.htmlworkshop.com/srhtml98.html
__________________
Lycanthrope is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:08 PM   #3
com
Confirmed User
 
Join Date: Aug 2003
Location: Portland, Oregon
Posts: 4,541
Quote:
Originally Posted by nibbi
I need to remove style content code from within <td> tags on hundreds of html pages. I figure the easiest way to do this would be a regular expression and a text editor.

So, anyone here know how to write a regular expression to turn this...

<td height="15" class="xl24" style="height:11.25pt">

Into this...

<td>
Thanks


simple the hardest bit is you may have to debug some of my escaping...

in VI:

%s/\<td height\=\"15\" class\=\"xl24\" style\=\"height:11.25pt\"\>/\<td\>/g
__________________

Real. Professional. Hosting.
.:Expect Nothing Less:.
320-078-843 :: www.realprohosting.com :: [email protected]
com is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:09 PM   #4
com
Confirmed User
 
Join Date: Aug 2003
Location: Portland, Oregon
Posts: 4,541
you may or may not need to escape the colon and period... plus some of the <> may not need to be escaped although doing so shouldnt hurt the expression. hope this helps, im running out the door to LA or id test it for ya! ciao!
__________________

Real. Professional. Hosting.
.:Expect Nothing Less:.
320-078-843 :: www.realprohosting.com :: [email protected]
com is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:11 PM   #5
Dynamix
G F Y not
 
Industry Role:
Join Date: Jan 2004
Location: MN
Posts: 2,910
Is it just <TD> tags? If so I can write something real quick to do it for you
__________________

TGPFactory Full TGP Design & Installation Services
ICQ 250 142 484 · AIM TGPDynamix · Email: patrick (at) tgpfactory (dot) com
See who I am at AdultWhosWho.com!
Dynamix is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:13 PM   #6
nibbi
Confirmed User
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 104
Quote:
Originally Posted by com

in VI:

%s/\<td height\=\"15\" class\=\"xl24\" style\=\"height:11.25pt\"\>/\<td\>/g

Actually, the contents of the tags contain many, many different variations... so that won't work. I need to be able to clear out *anything* that is within the tag.
__________________
http://www.xRag.com
nibbi is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:15 PM   #7
nibbi
Confirmed User
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 104
Quote:
Originally Posted by Dynamix
Is it just <TD> tags? If so I can write something real quick to do it for you
Yes, just <td> tags. Thank you.
__________________
http://www.xRag.com
nibbi is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:16 PM   #8
com
Confirmed User
 
Join Date: Aug 2003
Location: Portland, Oregon
Posts: 4,541
shit well last tidbit before I leave, the character $ means "end of", do a little reading on your regexes will show you how to do delete from <td -through end of line or statement and close it off with a >.

%s means match the following string
%s/shit/fuck/g means replace all instances of shit with fuck. ^ is beginning of doc or line $ is end. good luck wish i had more time! ciao
__________________

Real. Professional. Hosting.
.:Expect Nothing Less:.
320-078-843 :: www.realprohosting.com :: [email protected]
com is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:26 PM   #9
nibbi
Confirmed User
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 104
Got something to work:

Search for this:
<td[^>]*>

Replace with this:
<td>

This was done in TextPad.
__________________
http://www.xRag.com
nibbi is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 03:37 PM   #10
Dynamix
G F Y not
 
Industry Role:
Join Date: Jan 2004
Location: MN
Posts: 2,910
http://www.pimpts.com/dl/tdslicer.exe

Drag and drop files from Windows Explorer onto this. File is saved as the original but appended with _new..

ie:
original - c:\file.html
new - c:\file_new.html

Only parses .html and .htm files
__________________

TGPFactory Full TGP Design & Installation Services
ICQ 250 142 484 · AIM TGPDynamix · Email: patrick (at) tgpfactory (dot) com
See who I am at AdultWhosWho.com!
Dynamix is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-15-2005, 04:05 PM   #11
nibbi
Confirmed User
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 104
Quote:
Originally Posted by Dynamix
Cool tool, Thanks.

I used it on a few of the files and it worked perfectly. I used TextPad for the rest. Seemed to do the job faster.

Thanks again for helping me with this.
__________________
http://www.xRag.com
nibbi is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.