![]() |
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 |
Maybe this can help you: http://www.htmlworkshop.com/srhtml98.html
|
Quote:
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 |
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!
|
Is it just <TD> tags? If so I can write something real quick to do it for you
|
Quote:
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. |
Quote:
|
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 |
Got something to work:
Search for this: <td[^>]*> Replace with this: <td> This was done in TextPad. |
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 |
Quote:
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. |
All times are GMT -7. The time now is 06:37 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123