in reply to Re^2: regex (between two words)
in thread regex (between two words)

> I think I'd rather prefer splitting the longest match ...

DB<205> p $_ = join " ", map { "$_" x 3 } qw/. a b C a d C e C ./ ... aaa bbb CCC aaa ddd CCC eee CCC ... DB<206> p ($long) = /(aaa.*CCC)/ aaa bbb CCC aaa ddd CCC eee CCC DB<207> $last = "" DB<208> x map {$last .= $_ } split /(?<=CCC)/, $long 0 'aaa bbb CCC' 1 'aaa bbb CCC aaa ddd CCC' 2 'aaa bbb CCC aaa ddd CCC eee CCC' DB<209>

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice