use strict; use warnings; my @dates; my $string = do {$/ = ""; }; while ($string =~ /\b(\d{2})-(\d{2})-(\d{4})\sPerl\sParty/g) { push @dates, "$1\.$2\.$3"; } print join "\n", @dates; __DATA__ All kinds of text 01-01-2003 Perl Party more text 01-01-2004 Perl Party and even more text 01-01-2005 Perl Party and finally some other date 01-01-2006