mr_p has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
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; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Help with RegEx
by kennethk (Abbot) on Jul 01, 2010 at 15:59 UTC | |
by mr_p (Scribe) on Jul 01, 2010 at 16:05 UTC | |
by mr_p (Scribe) on Jul 01, 2010 at 16:09 UTC | |
by Corion (Patriarch) on Jul 01, 2010 at 16:18 UTC | |
by mr_p (Scribe) on Jul 01, 2010 at 16:36 UTC | |
by Corion (Patriarch) on Jul 01, 2010 at 16:43 UTC | |
| |
by mr_p (Scribe) on Jul 01, 2010 at 16:20 UTC | |
by Corion (Patriarch) on Jul 01, 2010 at 16:29 UTC | |
Re: Help with RegEx
by furry_marmot (Pilgrim) on Jul 01, 2010 at 21:58 UTC | |
| |
Re: Help with RegEx
by ikegami (Patriarch) on Jul 01, 2010 at 19:47 UTC | |
by mr_p (Scribe) on Jul 02, 2010 at 14:12 UTC | |
by ikegami (Patriarch) on Jul 02, 2010 at 18:12 UTC |
Back to
Seekers of Perl Wisdom