my $string = "hello world ballloon"; my $regex = qr/ll/; my @matches; push @matches, [$-[1], $+[1]] while $string =~ /(?=($regex))/g; print "@$_\n" for @matches;