in reply to Re^2: My code seems messy...
in thread My code seems messy...
output:#!/usr/bin/perl use strict; use warnings; while (<DATA>){ if ( # month day / ( [JFMASOND][a-z]{2,8} # full or 3 letter month name \s [123]?\d # day number (?:-[123]?\d)? # optional dash and day number (?:,\s[123]?\d\s)* # optional list of day numbers (?:and\s)? # optional and (?:[123]?\d,?\s)? # optional end of list (?:19|20)\d{2} # year starting 19 or 20 ) /x ) { print "1: $1\n"; } elsif ( # day month / ( [123]?\d # day number (?:st|nd|rd|th)? # optional st, nd etc. \s+ [JFMASOND][a-z]{2,8} # month name \s+ (?:19|20)\d{2} # year starting 19 or 20 ) /x ) { print "2: $1\n"; } } __DATA__ ...the next social club meeting is on April 15, 1994... ...September 21-23, 1994 we will be hosting visitors... ...submissions should be made by 11 February 1994... ...Mail sent 7 Feb 1994... ...On the 16th September 1994 Mr X will be giving a talk on ... ...unconfirmed conference dates are March 4, 5 and 6, 1994...
---------- Capture Output ---------- > "C:\Perl\bin\perl.exe" _new.pl 1: April 15, 1994 1: September 21-23, 1994 2: 11 February 1994 2: 7 Feb 1994 2: 16th September 1994 1: March 4, 5 and 6, 1994 > Terminated with exit code 0.
|
|---|