Adding HTML code to text

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

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

Adding HTML code to text

Post 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.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Adding HTML code to text

Post 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
HeadyNugs
Posts: 2
Joined: Sat Apr 25, 2009 3:23 am

Re: Adding HTML code to text

Post 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
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Adding HTML code to text

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