regex help

Reedick, Andrew jr9445 at ATT.COM
Tue Jun 3 15:51:44 CEST 2008


> From: python-list-bounces+jr9445=att.com at python.org 
> [mailto:python-list-bounces+jr9445=att.com at python.org] 
> On Behalf Of Support Desk
> Sent: Tuesday, June 03, 2008 9:32 AM
> To: python-list at python.org
> Subject: regex help
>
> I am trying to put together a regular expression that will 
> rename users address books on our server due to a recent 
> change we made.  Users with address books user.abook need 
> to be changed to user at domain.com.abook I'm having trouble 
> with the regex. Any help would be appreciated.


import re

emails = ('foo.abook', 'abook.foo', 'bob.abook.com', 'john.doe.abook')

for email in emails:
	print email, '-->', 
	print re.sub(r'\.abook$', '@domain.com.abook', email)



*****

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA623





More information about the Python-list mailing list