in reply to Match text from txt to html
Lots of ideas! But first, tell us what you've tried in Perl.
Alex / talexb / Toronto
Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.
Thank you for your reply.
To be honest, I have no idea... I know Perl but I don't know where to start.
What I did, was to read the TXT and store it in an array, then I read line by line the HTML and match the sentences without tags.
Great! And is the code working correctly? (Quietly loads the confetti cannon.)
this is my code as of now.
my $html = shift;
open(my $fh, '<', $html) or die "cannot open file $html";
$htmlvar = <$fh>;
my $line = 1;
if ($htmlvar =~ /$_/ && $htmlvar !~ /<sentence id\"[0-9]*\">$_<\/
$htmlvar =~ s/($_)/<sentence id\"$line\">$1<\/sentence>/;
Thanks! I am opening the html this way as I don't know the nodes of the files. the created automatically, so this is why I am reading them as text.
www.com | www.net | www.org
A scientific project
A system/database administration tool
A toy/personal tool
Other web based tool
None of the above
Results (91 votes). Check out past polls.