Help with Regular Expressions matching

antonmuhin на rambler.ru antonmuhin at rambler.ru
Fri Jan 31 06:30:27 EST 2003


Hello Ian,

Friday, January 31, 2003, 11:32:12 AM, you wrote:

If you mustn't stick to regular exceptions, there could be a little
bit cleaner solution:

email = "foo at boo.com"
domain = email.split('@')[1] # Get a domain
if domain in enabledDomains:
    # Process it
else:
    #ignore it

IB> On Fri, 2003-01-31 at 01:26, ajit k jena wrote:
>> Someone in mailman mailing list suggested a regular expression of the
>> form:
>> 
>>       ^.*?@(?!your\.domain\.com$)

IB> Try:

IB> (?!your\.domain\.com)$

IB> This will reject any address that doesn't end in your.domain.com.




-- 
Best regards,
 antonmuhin                            mailto:antonmuhin at rambler.ru






More information about the Python-list mailing list