Page 1 of 1

Adding HTML code to text

Posted: Sat Apr 25, 2009 3:49 am
by HeadyNugs
Hello, I'm new to text pipe and find this program very amazing, yet confusing.
I have html files that were converted from excel files. I have to make some adjustments, most of them was able to figure out but some are just to confusing...
Here's somethings I need to do:

Add HTML tag around the image file names from
<td>imagename.jpg</td>
to this
<td><img src="/image/Products/imagename.jpg" alt="" ></td>

I also need to get rid of these columns in the table:
<td class=xl6627352 align=right width=56 style='border-top:none;border-left:
none;width:42pt'>$Prices.XX </td>
erase these columns completely.

Please not that my knowledge in this program is very limited. Only scripts I know are HTML coding and JavaScript, nothing about Perl or anything like that. Thank you for your help and advice, it is greatly appreciated.

Re: Adding HTML code to text

Posted: Mon Apr 27, 2009 8:47 am
by DataMystic Support
1. Find perl pattern:

Code: Select all

<td>([^\r\n]*\.jpg)</td> 
Replace with:

Code: Select all

<td><img src="$1" alt="" ></td>
2. Find perl pattern:

Code: Select all

<td class=xl6627352 align=right width=56 style='border-top:none;border-left:
none;width:42pt'>([\$\d\.\s]*)</td>
Replace with nothing

Re: Adding HTML code to text

Posted: Tue Apr 28, 2009 3:20 am
by HeadyNugs
Thank You Simon!
I've gotten the image tags to work perfectly, but the other one i had a little trouble with...

some of the width properties vary from file to file so i would have to use a perl script to find this:

<td class=xl6627352 align=right width=56 style='border-top:none;border-left:
none;width:42pt'>$Prices.XX </td>

Would there be a general code I can use for finding these sort of problems with perl? Or might there be any tutorials that I can read up on for this matter?
Thanks Again

Re: Adding HTML code to text

Posted: Tue Apr 28, 2009 10:19 am
by DataMystic Support
Just use a perl pattern in TextPipe of course!

<td class=xl6627352 align=right width=(\d+) style='border-top:none;border-left:
none;width:(\d+)pt'>$Prices.XX </td>