coltman has asked for the wisdom of the Perl Monks concerning the following question:
It works now. I am really grateful to davorg, Fletch, johngg, aggianni,anno, and shmem for all your helpful comments and suggestions. I just get to know PERL for about two weeks and it is great that I find this forum and so many nice and helpful experts here.my $aa = "Accepted and agreed to by Jerry Smith as of the 1st day of N +ovember 2005."; if ( $aa =~ m{ (?:as of)* (?:\s|\n)* #for any possible space or line end (?:this|the)* (?:\s|\n)* #for any possible space or line end ( (?:[1-31]) #day, 1 to 31 (?:st|nd|rd|th) #for all the cases like 1st, 2nd, 3rd, 25th (?:\s|\n)* #for any possible space or line end (?:day of)* (?:\s|\n)* #for any possible space or line end (?:January|February|March|April|May|June|July| August|September|October|November|December) (?:\s|\n)* #for any possible space or line end (?:\,|\s)* #for any possible space or comma end (?:\s|\n)* #for any possible space or line end ([1,2]\d{2,3}) #year ) (?:\,|\.|\s)* (?:[ ]{2}|\n|\z)* #Two spaces, newline, or string end }ixmsg) { print $1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex question
by davorg (Chancellor) on Mar 22, 2007 at 14:36 UTC | |
by Fletch (Bishop) on Mar 22, 2007 at 14:47 UTC | |
by johngg (Canon) on Mar 22, 2007 at 15:17 UTC | |
|
Re: Regex question
by agianni (Hermit) on Mar 22, 2007 at 14:44 UTC | |
|
Re: Regex question
by Anno (Deacon) on Mar 22, 2007 at 14:58 UTC | |
|
Re: Regex question
by shmem (Chancellor) on Mar 22, 2007 at 15:12 UTC |