I am trying to pull out the href from these lines and I don't know why the RegEx is not returning before and after characters of stylesheet.
#!/usr/bin/perl -w use strict; my @ss = getItemsFromFile(); foreach my $s (@ss) { print "$s\n"; } sub getItemsFromFile { local $/=undef; my ($line_in) = "\n<?xml-stylesheet href=\"perl1.css\" type=\"text +/css\"?>\n \n<link href=\"//www.perl.org/css/perl1.css\" rel=\"stylesheet\">\n \n<link href=\"/css/perl.css\" rel=\"stylesheet\">\n"; my @allItems=(); while ($line_in =~ m{<(.*?)stylesheet(.*?)>}gis) { push (@allItems, $1); } return @allItems; }
In reply to Help with RegEx by mr_p
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |