Replace with Variable Data from within the same file

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

John Kihn

Replace with Variable Data from within the same file

Postby John Kihn » Tue Dec 09, 2003 5:32 pm

I have a bunch of html files with

<title>A generic title that is the same for all files</title>

and then farther down in the file
<span>Title: This is the real title and it varies in all the files</span>

I have not been able to figure out a way to replace the generic title with the real title text within the span tags. I have been able to isolate the real title text but cannot figure out how to reuse it in a replace

Any help would be most appreciated.

John

John Kihn

Figured it out

Postby John Kihn » Tue Dec 09, 2003 9:56 pm

OK I used textpipe to create a file of filenames and replacement strings then used the technique descibed in the post about replace with filenames and it works. Sort of cumbersome but got the job done.

John

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

Postby DataMystic Support » Wed Dec 10, 2003 1:52 pm

You can do a lot better using a pattern match for

<title>(.*)</title>(.*)<span>Title: (.*)</span>

Replace with

<title>$3</title>$2<span>Title: $3</span>
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: Baidu [Spider], Google [Bot], Yahoo [Bot] and 8 guests