Using Regular Expressions to Remove Table Data
Posted On: December 5, 2008 at 1:47 p.m.
We’re working on a project that requires us to enter tons of data from a static .html based site. Unfortunately this data is in tables. In order to speed up the process of moving this data into the new Django based site using a CSS layout we created a handy little regular expression to strip out all those table based tags.
To use it simply copy out the code from the source file and paste it into textmate (you do use textmate, right?). Then do a find and check the regular expression box. Put this in the Find field:
<[/]*t[ =\d\w”]*>
Leave the Replace: field blank and then hit replace all. This will remove all:
table th tr td
tags from the copied text. Thanks to Django for showing me how powerful regular expressions are. Its a bit of a learning curve but its well worth the time.

Comments