Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading metatags

Status
Not open for further replies.

redstarfcs1

Programmer
Sep 21, 2005
7
RO
How to read metatags without any perl module?
 
Hi feherke

Thank you. No, that was not rude :)

I'll see what i can do to solve the problems of additional information, as per your examples


Kind Regards
Duncan
 
Hmmm.. this looks like it works will all the examples that have been provided; it's a mess though!

Code:
local undef $/;
my $text = <DATA>;

my (@meta_data) = $text =~ m[(<meta[^>]+>)]ig;
foreach my $tag (@meta_data) {
    my (@results)= grep {defined && /[^'"]/} $tag =~ m!.*?['"]?(\w+)['"]?=(?(?=['"])(['"]))(.+?)(?(2)\2|\b)!isg;    
    my $ref = {@results};
    foreach (keys %$ref) {
        print "$_ - $ref->{$_}\n";
    }
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top