[Mailman-Users] Filter to discard facebook invitations

2010-04-04 Thread John List
Why doesn't the following discard_these_nonmembers filter work for 
facebook invitations:


^...@]*@facebookmail.com

-John
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] Filter to discard facebook invitations

2010-04-04 Thread Mark Sapiro
John List wrote:

Why doesn't the following discard_these_nonmembers filter work for 
facebook invitations:

^...@]*@facebookmail.com


Because while it is a valid Python regexp
http://docs.python.org/library/re.html, it doesn't say what you mean.

The correct way to say what I think you mean by that is

  ^...@]*@facebookmail.com

I.e. [...@] matches anything which is not '@'; [...@] matches just '!' or
'@'.

However, I would use

  ^...@.]facebookmail\.com$

to match any address in the facebookmail.com domain or a sub-domain or

  ^...@facebookmail\.com$

to match addresses in only the facebookmail.com domain.





-- 
Mark Sapiro m...@msapiro.netThe highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan

--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org


Re: [Mailman-Users] Filter to discard facebook invitations

2010-04-04 Thread Elaine Ashton

On Apr 4, 2010, at 10:22 AM, John List wrote:

 Why doesn't the following discard_these_nonmembers filter work for facebook 
 invitations:
 
 ^...@]*@facebookmail.com

In addition to what Mark has already pointed out, I thought I would add that 
the python regex documentation ( 
http://docs.python.org/library/re.html#re-syntax ) has a helpful routine for 
debugging regexen right on the command-line, e.g.

Python 2.6.4 (r264:75706, Feb 14 2010, 14:03:47) [C] on sunos5
Type help, copyright, credits or license for more information.
 import re
 def displaymatch(match):
... if match is None:
... return None
... return 'Match: %r, groups=%r' % (match.group(), match.groups())
... 
 valid = re.compile(r^...@]*@facebookmail.com)
 displaymatch(valid.match(foo...@facebookmail.com))
 displaymatch(valid.match(foo!...@facebookmail.com))
 displaymatch(valid.match(!foo!...@facebookmail.com))
 displaymatch(valid.match(@facebookmail.com))
Match: '@facebookmail.com', groups=()
 displaymatch(valid.match(!...@facebookmail.com))
Match: '!...@facebookmail.com', groups=()
 valid = re.compile(r^...@.]facebookmail\.com)
 displaymatch(valid.match(foo...@facebookmail.com))
Match: 'foo...@facebookmail.com', groups=()
 displaymatch(valid.match(foo...@bar.facebookmail.com))
Match: 'foo...@bar.facebookmail.com', groups=()

I always find it handy since I like to be sure that I'm not matching more (or 
less) than I bargained for. :)

e.
--
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org