Frederic Rentsch wrote:
> If I may add another thought along the same line: regular expressions
> seem to tend towards an art form, or an intellectual game. Many
> discussions revolving around regular expressions convey the impression
> that the challenge being pursued is finding a magic formul
> for dense guys like myself, regular expressions work best if you use
> them as simple tokenizers, and they suck pretty badly if you're trying
> to use them as parsers.
:) Well, I'm with you on that one Fredrik! :)
--
http://mail.python.org/mailman/listinfo/python-list
> I still don't touch regular expressions... They may be fast, but to
> me they are just as much line noise as PERL... I can usually code a
> partial "parser" faster than try to figure out an RE.
Yes, it seems to me that REs are a bit "hit and miss" - the only way to
tell if you've got a RE "righ
Dennis Lee Bieber wrote:
> On 25 Sep 2006 10:25:01 -0700, "codefire" <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
>> Yes, I didn't make it clear in my original post - the purpose of the
>> code was to learn something about regexps (I only started coding Python
>> last w
Yes, I didn't make it clear in my original post - the purpose of the
code was to learn something about regexps (I only started coding Python
last week). In terms of learning "a little more" the example was
successful. However, creating a full email validator is way beyond me -
the rules are far too
Hi,My $0.02:re.compile('^\w+([\.-]?\w+)[EMAIL PROTECTED]([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|intl|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$')I picked it up from the Net, and while it may be not perfect (you've got lots of reply's telling you why),it's good enough for me.Good luck,Sorin--
John Machin wrote:
> Ant wrote:
> > John Machin wrote:
> > ...
> > > A little more is unfortunately not enough. The best advice you got was
> > > to use an existing e-mail address validator.
> >
> > We got bitten by this at the last place I worked - we were using a
> > regex email validator (from
Ant wrote:
> John Machin wrote:
> ...
> > A little more is unfortunately not enough. The best advice you got was
> > to use an existing e-mail address validator.
>
> We got bitten by this at the last place I worked - we were using a
> regex email validator (from Microsoft IIRC), and we kept having
Ben Finney wrote:
...
> The best advice I've seen when people ask "How do I validate whether
> an email address is valid?" was "Try sending mail to it".
There are advantages to the regex method. It is faster than sending an
email and getting a positive or negative return code. The delay may not
b
John Machin wrote:
...
> A little more is unfortunately not enough. The best advice you got was
> to use an existing e-mail address validator.
We got bitten by this at the last place I worked - we were using a
regex email validator (from Microsoft IIRC), and we kept having
problems with specific
"John Machin" <[EMAIL PROTECTED]> writes:
> A little more is unfortunately not enough. The best advice you got was
> to use an existing e-mail address validator. The definition of a valid
> e-mail address is complicated. You may care to check out "Mastering
> Regular Expressions" by Jeffery Friedl
codefire wrote:
> Hi,
>
> thanks for the advice guys.
>
> Well took the kids swimming, watched some TV, read your hints and
> within a few minutes had this:
>
> r = re.compile(r'[EMAIL PROTECTED]@\s]+\.\w+')
>
> This works for me. That is if you have an invalid email such as
> tony..bATblah.com it
Hi,
thanks for the advice guys.
Well took the kids swimming, watched some TV, read your hints and
within a few minutes had this:
r = re.compile(r'[EMAIL PROTECTED]@\s]+\.\w+')
This works for me. That is if you have an invalid email such as
tony..bATblah.com it will reject it (note the double do
codefire wrote:
> Hi,
>
> I am trying to get a regexp to validate email addresses but can't get
> it quite right. The problem is I can't quite find the regexp to deal
> with ignoring the case [EMAIL PROTECTED], which is not valid. Here's
> my attempt, neither of my regexps work quite how I want:
>
On 2006-09-21, codefire <[EMAIL PROTECTED]> wrote:
> I am trying to get a regexp to validate email addresses but
> can't get it quite right. The problem is I can't quite find the
> regexp to deal with ignoring the case [EMAIL PROTECTED],
> which is not valid. Here's my attempt, neither of my regexp
codefire wrote:
> Hi,
>
> I am trying to get a regexp to validate email addresses but can't get
> it quite right. The problem is I can't quite find the regexp to deal
> with ignoring the case [EMAIL PROTECTED], which is not valid. Here's
> my attempt, neither of my regexps work quite how I want:
>
Hi,
I am trying to get a regexp to validate email addresses but can't get
it quite right. The problem is I can't quite find the regexp to deal
with ignoring the case [EMAIL PROTECTED], which is not valid. Here's
my attempt, neither of my regexps work quite how I want:
[code]
import os
import re
17 matches
Mail list logo