$_ = 'foofoostuff1tarbarfoostuff2barfoostuff3tarbar'; my @a = /foo((?:(?!bar|foo).)*?)tarbar/gs; print "@a\n";