What I am doing is content migration from .htmls to .asps. Im only grabbing everything thats within the body tags and copying it over to the new asp in the same directory/folder. I also need to capture any of the meta information found in the meta tag. Like
<meta http-equiv="Keywords" content="Sun, Sun Bank, Bank, banking>
This content can sometimes be found on multiple lines. I am able to grab the content that is found on only one line by the following code
#if the meta is only on one line
if (/\<meta(.*)\>/i) {
# grab the meta tag lines
print OUTFILE $_ . "\n";
}
I am having trouble when I need to grab the content from multiple lines
the code I am using to try and do this is
#grabbing and printing everything between the meta tags if it
+is on multiple lines
if (/<meta.*?>/i ... /.*?>/i){
# this is a title line
# extract the title
$meta_temp = $_;
$meta_temp =~ s/(.*?)\<meta\>(.*?)\>/$2/i;
chomp($meta_temp);
$meta = "$meta_temp" ;
# Write the meta to the output file
print OUTFILE $meta . "\n";
}
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.