in reply to Re^2: Regex to catch UP TO a particular string?
in thread Regex to catch UP TO a particular string?

In your second post, you split your summary into lines

my @split = split /\n/, $summary;

However your expected result contains multiple lines. The regex matches the beginning of the next line starting with [[ - and as the [[ occurs in the first column, that match is empty.

Try to work on your original data, not the line-by-line-version, e.g. by replacing

if (/\Q[[$article_name]]\E(.*?)\[\[/s) {

with

if ($summary =~ /\Q[[$article_name]]\E(.*?)\[\[/s  {

Replies are listed 'Best First'.
Re^4: Regex to catch UP TO a particular string?
by ultranerds (Hermit) on Mar 24, 2010 at 14:45 UTC
    Yeah, that was it - realised it just after I posted (typical!)

    Thanks anyway :)

    Andy