redstarfcs1
Programmer
How to read metatags without any perl module?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
ChrisHunt said:Use eyes.
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";
}
}