Cyndi Norwitz wrote: >I am getting a lot of spam post attempts from a domain tom.com. I >would like to do an automatic discard in discard_these_nonmembers for >this domain. > >I can add this line of code: ^...@]+@(.*\.)?tom\.com$ > >But I am concerned that this will discard all .com domain names that >end with tom, which may be some legit ones.
It won't >I do not understand the code as it's different from anything I've >worked with and the above recipe (which I mucked up several times on >my own despite some trips to the FAQ) came from Mark. My guess is I >need to remove the question mark, but I'd like confirmation first. It you remove the question mark, the regexp will match only sub-domains of tom.com. I.e., it will match x...@y.tom.com, but not x...@tom.com. As it is, it will match either of those, and it won't match x...@tomtom.com because the piece preceding tom.com doesn't end with a period. Here's what it says: ^...@]+ matches the beginning of the line and 1 or more non-@ characters, so ^...@]+@ matches everything up to the first @ as long as there is at least one character before the @. Then (.*\.)? matches 0 or 1 occurrences of anything that ends with a literal period - the ? says 0 or 1 of the preceding. Then tom\.com$ matches if the remainder ends with 'tom.com'. So the whole regexp matches at least one non-@ followed by @ optionally followed by anything that ends with a period followed by tom.com at the end. See <http://docs.python.org/library/re.html>. -- Mark Sapiro <m...@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better 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 Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: http://mail.python.org/mailman/options/mailman-users/archive%40jab.org Security Policy: http://wiki.list.org/x/QIA9