in reply to Re: Regex to catch UP TO a particular string?
in thread Regex to catch UP TO a particular string?
my @tags; my $i = 0; my @split = split /\n/, $summary; foreach (@split) { my $contents; if ($_ !~ /^\s*\t*\[\[(.*)\]\]/) { next; } print qq|Tag is: $1 \n|; my $article_name = $1; if (/\Q[[$article_name]]\E(.*?)\[\[/s) { print "got content: $1 \n"; $contents = $1; } push @tags, { name => $article_name, contents => $contents }; + } use Data::Dumper; print Dumper(@tags);
..any ideas?$VAR1 = { 'contents' => undef, 'name' => 'France' }; $VAR2 = { 'contents' => undef, 'name' => 'Cities of France' }; $VAR3 = { 'contents' => undef, 'name' => 'Things to see in France' }; $VAR4 = { 'contents' => undef, 'name' => 'Things to do in France' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex to catch UP TO a particular string?
by Ratazong (Monsignor) on Mar 24, 2010 at 14:42 UTC | |
by ultranerds (Hermit) on Mar 24, 2010 at 14:45 UTC | |
|
Re^3: Regex to catch UP TO a particular string?
by ultranerds (Hermit) on Mar 24, 2010 at 14:42 UTC |