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; }
In reply to Regex question by coltman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |