Regular Expression Help Needed

Chris Tavares christophertavares at earthlink.net
Fri Nov 16 22:00:00 EST 2001


"David A McInnis" <david at dataovation.com> wrote in message
news:mailman.1005960683.29958.python-list at python.org...
> Ok, I am not very good at regular expressions, so any help is greatly
> appreciated.
>
> Here is the situation.
>
> I have a database table that contains a text field.  This text field may
or
> may not contain email addresses.  I know how to read the content of field
to
> a string.  Now what I need is a regular expression that I could use to
> identify any email addresses in the string.  Since the email can be in
mixed
> case, I need a solution that is case insensitive.
>
> So, there may be one or more email addresses in the string.  When I find
> one, I need to added it to a list variable and look for other addresses in
> the string.
>
> Thanks,
>
> David McInnis
>

Get a copy of _Mastering Regular Expressions_, by Jeffrey Friedl, from
O'Reilly press. The regular expression you want is in the back.

Be warned - it's over 4000 characters long, and it still doesn't work in all
cases. Email addresses are not a regular language, and therefore cannot be
completely matched by regular expressions.

-Chris







More information about the Python-list mailing list