Page 1 of 1

Search and replace HTML code

Posted: Wed Mar 29, 2006 9:47 am
by Method
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!

Posted: Thu Mar 30, 2006 9:33 am
by DataMystic Support
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.

Posted: Thu Mar 30, 2006 11:21 am
by Method
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.

Posted: Thu Mar 30, 2006 11:59 am
by DataMystic Support
Ah - but you can preview the changes in DataPipe, and also confirm each change, just like in TextPipe.