On 08/30/2015 04:43 AM, Steven D'Aprano wrote:
> On Sun, Aug 30, 2015 at 02:06:26AM -0700, Nelson Kelly wrote:
>>
>> All the new spams appear to be of a slightly different format from which 
>> I described in the OP.
>>
>> blahblah+blah-blah-blah-blah-12345...@gmail.com
>> blah_12_34+blah-blah-blah-blah-12345...@hotmail.com


I'm now seeing these too.


> Try this regex instead:
> 
> ^.*\+.*?\d{3,}@
> 
> 
> The meaning of it is:
> 
> ^     start of string
> .*    any number of characters
> \+    a literal plus sign
> .*?   any number of characters (non-greedy)
> \d{3,}        at least three digits
> @     a literal at sign
> 
> 
> I'm not sure if the difference between "non-greedy" .*? and "greedy" .* 
> is important in this case.


It doesn't matter here. It would matter if there were groups. E.g.,

^.*\+(.*?)(\d{3,})@

In this case, the (.*?) group would match everything after the '+' up to
and not including the digits and the (\d{3,}) group would match all the
digits.

If the first group were greedy, i.e. (.*) without the ?, it would match
up to the last 3 digits and the (\d{3,}) group would match only the last
3 digits.

-- 
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
https://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: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Reply via email to