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 derfloh 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
Joined
Sep 21, 2005
Messages
7
Location
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
 
ChrisHunt said:
Use eyes.

It was all just a joke between me and ishnid, not meant to be taken seriously mate. [upsidedown]
 
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