Cannot formulate regex

Paul McGuire ptmcg at austin.rr.com
Sun Sep 16 11:38:19 EDT 2007


On Sep 16, 10:18 am, "Dotan Cohen" <dotanco... at gmail.com> wrote:
> I'd like to filter spam from a certain company. Here are examples of
> strings found in their spam:
> Mega Dik
> Mega D1k
> MegaDik
> Mega. Dik
> M eg ad ik
> M E _G_A_D_ IK
> M_E_G. ADI. K
>
> I figured that this regex would match all but the second example, yet
> it matches none:
> |[^a-z]m[^a-z]e[^a-z]g[^a-z]a[^a-z]d[^a-z]i[^a-z]k[^a-z]|i
>
> What would be the regex that matches "megadik" regardless of whatever
> characters are sprinkled throughout?
>
> Thanks in advance.
>
> Dotan

Or you could try using "MegaRegex"!  I do and my girlfriend can't stop
talking about it! :)

-- Paul




More information about the Python-list mailing list