Search and replace HTML code

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

Method
Posts: 2
Joined: Wed Mar 29, 2006 9:42 am

Search and replace HTML code

Postby Method » Wed Mar 29, 2006 9:47 am

I'm trying out TextPipe Pro, i've heard that it works wonders, but it doesn't seem to be doing what I need it to, which in my mind is pretty simple.

I have a database of about 7,000 products that have lengthy HTML descriptions - I"m trying to strip them down because it's slowing down the entire site.

I have a list of the things that I either need to remove or replace with other code. I have exported the data as a csv file. TextPipe Pro can't find anything I put in though, with exact match, perl, everything. I'm sure I'm doing something wrong, just can't figure out what.

I think it's because what I'm searching for is too long and wraps onto the next line.

Here is an example:

Replace:

<!-- BEGIN JBN CODE -->
</td></tr>
<tr><td width="100%" class="jbn_description_text"><p align="justify"><font class="jbn_description_title">


with:
<p align="justify" font class="jbn_description_text"><font class="jbn_description_title">

This is just one example, some of the other things I need to strip out are even longer than that

Can TPP do this, or am I barking up the wrong tree?

Thanks!

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

Postby DataMystic Support » Thu Mar 30, 2006 9:33 am

TextPipe handles multiple lines with ease, the problem here will be that what you're looking doesn't match what is in the file.

First, ensure that the file has DOS end-of-line characters (use Filters\Convert\End-of-lines).

Next, remove any stray spaces at the end of each line. In your search pattern you have stray spaces at the end of every line..

Finally, replace your line ends in the perl pattern with

[\r\n \t]* ie zero or more cr, lfs, spaces or tabs

So it would become (all on one line):

<!-- BEGIN JBN CODE -->[\r\n \t]*</td></tr>[\r\n \t]*<tr><td width="100%" class="jbn_description_text"><p align="justify"><font class="jbn_description_title">


BTW, our DataPipe product can apply this search/replace to your database directly, so there would be no need to extract and then re-load.
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

Method
Posts: 2
Joined: Wed Mar 29, 2006 9:42 am

Postby Method » Thu Mar 30, 2006 11:21 am

Thanks so much!

Although with my significantly less than professional knowledge of this program, the last thing I would want to do is directly edit my database. The damage control would last for weeks.

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

Postby DataMystic Support » Thu Mar 30, 2006 11:59 am

Ah - but you can preview the changes in DataPipe, and also confirm each change, just like in TextPipe.
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 “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 6 guests