Adding HTML code to text

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

HeadyNugs
Posts: 2
Joined: Sat Apr 25, 2009 3:23 am

Adding HTML code to text

Postby HeadyNugs » Sat Apr 25, 2009 3:49 am

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.

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

Re: Adding HTML code to text

Postby DataMystic Support » Mon Apr 27, 2009 8:47 am

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
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

HeadyNugs
Posts: 2
Joined: Sat Apr 25, 2009 3:23 am

Re: Adding HTML code to text

Postby HeadyNugs » Tue Apr 28, 2009 3:20 am

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

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

Re: Adding HTML code to text

Postby DataMystic Support » Tue Apr 28, 2009 10:19 am

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>
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: Yahoo [Bot] and 2 guests