Here's my attempt. I've used two regexes for the general cases of day month and month day.

#!/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...
output:
---------- 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.

In reply to Re^3: My code seems messy... by wfsp
in thread My code seems messy... by PerlGrrl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.