use strict; use warnings; my $dates = '5th April - 12th April xxxx, ssss, 3rd May - 23th May zzz! 1st June-2nd June, ddd'; my $subexp = qr{ (?:-\s*)? # may be we hit the second term \d+ (?:st|nd|rd|th) # the day \s+\w+\s* # the month }x; my @hits = $dates =~ /$subexp $subexp/xg; print join "\n", @hits;