in reply to pattern matching

GrandFather already identified the problem in your code; in case you'd like to extend your program to other numerals (1,2,3 - as noted by gangabass), there's another variant:

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;

Regards

mwa

Replies are listed 'Best First'.
Re^2: pattern matching
by chrism01 (Friar) on Nov 23, 2007 at 05:31 UTC
    Not sure I'd count '23th May' as a valid date ;-)
    Cheers
    Chris