my $test = do {local $/; }; if ($test =~ m{((?:deferred|unrealized).*?\.)\s*(.*?\.)\s*(.*?\.)}s) { print "print '$1', '$2', '$3'"; } __DATA__ foo bar. baz biz. deferred gross profit is blah blah blah. more blah. and yet more blah. But not this blah.