Hi Monks!
I have an html page and in it's source code I have some tags like
<!-- 1st table -->What I want 1<!-- /1st table -->more stuff...<!-- 2st movie -->What I want 2<!-- /2st movie -->...more stuff...<!-- 3st movie -->What I want 3<!-- /3st movie -->...more stuff
In the source code could be 1 or more than 10 tags, but my point is that I am trying to get only the content in the middle of these tags, using the code showing here, but can't get a match, any help on that?
Here is the code I am using to do the match:
#got the html page already and I saved as .txt
my $output_file = "/temp_my_news.txt";
open(OUTPUT, "$output_file") || print "There is no file here!";
while(<OUTPUT>) {
if ($_=~/<!-- 1nd table -->(.*?)<!-- \/1nd table -->/g) {
print $1;
}else{print "<br>Nothing Here!<br>";}
}
close OUTPUT;
Thanks for the Help!!!!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.