$ perl -wE 'q{Even more test address@test.com @20} =~ /[^@\n]*(?:\S@[^@\n]*)*/ and say $&' Even more test address $ perl -wE 'q{Even more test address@test.com @20} =~ /[^@\n]*(?:\S@[^@\n]*)+/ and say $&' Even more test address@test.com #### /[^\S\n]*(?:[^\s@]+@?[^\S\n]*)*/