The code:
while (<>) { $day = ''; print "Before: $_"; s/(Monday|Tuesday|Wednesday|Thursday|Friday| Saturday|Sunday)'s(\s+Games)?//x and $day = $1; print "After: $_"; print "Day = '$day'\n"; } The test: C:\>perl trw.tmp Yesterday's Games were boring Before: Yesterday's Games were boring After: Yesterday's Games were boring Day = '' Before Sunday's Games we partied Before: Before Sunday's Games we partied After: Before we partied Day = 'Sunday' After sunday's games we had hangover Before: After sunday's games we had hangover After: After sunday's games we had hangover Day = '' Monday we had to be at work Before: Monday we had to be at work After: Monday we had to be at work Day = '' Monday's work was no fun Before: Monday's work was no fun After: work was no fun Day = 'Monday' "Yesterday's Games were boring" was unaffected. "Before Sunday's Games we partied" had "Sunday's Games" stripped, and $day set to Sunday. "After sunday's games we had hangovers" was unaffected, because the match was case-sensitive. "Monday we had to be at work" was unaffected, because "Monday" had no apostrophe "Monday's work was no fun" had "Monday's" stripped, and $day set to Monday. Tom Wyant This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portugues Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs