Hi perlmonks
I have a problem to solve and I would appreciated your help.
I have a txt file which contains one sentence per line and its html correspondence, and I would like to write in the html which line matches with what sentence in the html. Please note that in html one line may contain more than one sentences.
For example, my TXL file looks like:
This is sentence 1 This is sentence 2 This is sentence 1 This is sentence 3
And the html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <body> <p>This is sentence 1</p> <p>This is <font color="#000000"><font face="Century Gothic, serif">se +ntence 2</font></font></p> <p>This is sentence 1. This is sentence <span style="font-weight: norm +al">3</span> </p> </body> </html>
As you can see, the html file contains some extra html code, which makes things complex.
What I want to do is to add some html code and wrap the sentence:
<p><sentence id=”1”>This is sentence 1></sentence></p> <p><sentence id=”2”>This is <font color="#000000"><font face="Century +Gothic, serif">sentence 2</font></font></p></sentence> <p><sentence id=”3”>This is sentence 1. </sentence><sentence id=”4”>Th +is is sentence <span style="font-weight: normal">3</span></sentence>< +/p>
The order of the TXT corresponds to the order of the HTML. If no match found, then it should go to the next segment. Any ideas?
Thanks in advance for your help
In reply to Match text from txt to html by corfuitl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |