Regular Expression Help Needed

William Park opengeometry at yahoo.ca
Sat Nov 17 04:38:33 EST 2001


On Sat, Nov 17, 2001 at 03:00:00AM +0000, Chris Tavares wrote:
> "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

What's wrong with '[\w.]+@\w+(\.\w+)*' ?

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>.
8 CPU cluster, NAS, (Slackware) Linux, Python, LaTeX, Vim, Mutt, Tin




More information about the Python-list mailing list