***********************
Your mail has been scanned by InterScan MSS.
***********************


Hello,

I'm trying to get working an assertion which filter address from some domain 
but if it's prefixed by '.com'.
Even trying to put the result in a negate test I can't get the wanted result.

The tought in program term :

>>> def filter(adr):
...     import re
...     allow = re.compile('.*\.my(>|$)')
...     deny = re.compile('.*\.com\.my(>|$)')
...     cnt = 0
...     if deny.search(adr): cnt += 1
...     if allow.search(adr): cnt += 1
...     return cnt
...
>>> filter('[EMAIL PROTECTED]')
2
>>> filter('[EMAIL PROTECTED]')
1
>>>

Seem that I miss some better regex implementation to avoid that both of the 
filters taking action. I'm thinking of lookbehind (negative or positive) 
option, but I think I couldn't realize it yet.
I think the compilation should either allow have no '.com' before '.my' or 
deny should have _only_ '.com' before '.my'. Sorry I don't get the correct 
sintax to do it.

Suggestions are welcome.

F


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to