in reply to Combinatorial regexing

This uses a look-ahead but in a slightly different way to blokhead's solution. The regex looks for and captures a letter sequence then uses a look-ahead with a capture to find another sequence.

use strict; use warnings; my $string = q{abc de fgh ijkl}; my $rxComb = qr {(?x) (?: ([a-z]+) \s+ (?=([a-z]+)) ) }; while ( $string =~ m{$rxComb}g ) { print qq{$1 $2\n}; }

Here's the output.

abc de de fgh fgh ijkl

I hope this is of use.

Cheers,

JohnGG