emails with 4 chars in suffix

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Iain Downie

    emails with 4 chars in suffix

    Dear list,

    we are getting a few folk trying to register for our birdwatching surveys
    with emails of the form: aname@phonecoop .coop, in other words with a 4
    character ending (other examples are .info).

    Currently, I use a regexp to check on 'normal' emails with 3 chars.....

    function checkEmail() {
    var emailVar = document.shorte r.email.value;
    if (emailVar.lengt h > 0){
    if
    (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3 })+$/.test(document. shorter.email
    ..value))
    {
    return (true)
    }
    else
    {
    alert("Invalid E-mail Address! Please re-enter.")
    document.shorte r.email.select( );
    }
    }
    }


    Does anyone know of a similar function that can handle the type of e-mail I
    described above with 4 chars? My knowledge of what regexp is doing is a tad
    limited to say the least (none - looks gibberish to me but it does work
    well!)

    Cheers
    Iain

    Dr Iain Downie
    British Trust for Ornithology, The Nunnery, Norfolk IP24 2PU, UK
    Tel: +44 (0)1842 750050, fax: +44 (0)1842 750030 ® Charity No. 216652


  • Mick White

    #2
    Re: emails with 4 chars in suffix

    Iain Downie wrote:
    [color=blue]
    > Dear list,
    >
    > we are getting a few folk trying to register for our birdwatching surveys
    > with emails of the form: aname@phonecoop .coop, in other words with a 4
    > character ending (other examples are .info).
    >
    > Currently, I use a regexp to check on 'normal' emails with 3 chars.....
    >
    > function checkEmail() {
    > var emailVar = document.shorte r.email.value;
    > if (emailVar.lengt h > 0){
    > if
    > (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3 })+$/.test(document. shorter.email
    > .value))
    > {[/color]

    [snip]

    (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,} )+$/
    Allows suffix to be 2 or more characters

    (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6 })+$/
    Allows suffix to be between 2 and 6 characters (inclusive)
    Mick

    Comment

    • Iain Downie

      #3
      Re: emails with 4 chars in suffix

      Thanks, simple really. I had actually tries this, but only tentatively and
      my browser must have cached the old version so it kept falling over.

      Cheers
      Iain

      "Mick White" <mwhite13BOGUS@ rochester.rr.co m> wrote in message
      news:8ySEd.1391 80$AL5.120363@t wister.nyroc.rr .com...[color=blue]
      > Iain Downie wrote:
      >[color=green]
      > > Dear list,
      > >
      > > we are getting a few folk trying to register for our birdwatching[/color][/color]
      surveys[color=blue][color=green]
      > > with emails of the form: aname@phonecoop .coop, in other words with a 4
      > > character ending (other examples are .info).
      > >
      > > Currently, I use a regexp to check on 'normal' emails with 3 chars.....
      > >
      > > function checkEmail() {
      > > var emailVar = document.shorte r.email.value;
      > > if (emailVar.lengt h > 0){
      > > if
      > >[/color][/color]
      (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3 })+$/.test(document. shorter.email[color=blue][color=green]
      > > .value))
      > > {[/color]
      >
      > [snip]
      >
      > (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,} )+$/
      > Allows suffix to be 2 or more characters
      >
      > (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6 })+$/
      > Allows suffix to be between 2 and 6 characters (inclusive)
      > Mick[/color]


      Comment

      • Dr John Stockton

        #4
        Re: emails with 4 chars in suffix

        JRS: In article <cs0q3b$f6m$1$8 302bc10@news.de mon.co.uk>, dated Tue, 11
        Jan 2005 15:06:32, seen in news:comp.lang. javascript, Iain Downie
        <iain.downie@bt o.org> posted :
        [color=blue]
        >we are getting a few folk trying to register for our birdwatching surveys
        >with emails of the form: aname@phonecoop .coop, in other words with a 4
        >character ending (other examples are .info).
        >
        >Currently, I use a regexp to check on 'normal' emails with 3 chars.....[/color]
        [color=blue]
        >Does anyone know of a similar function that can handle the type of e-mail I
        >described above with 4 chars?[/color]

        Don't try to impose any restrictions on E-mail addresses unless you are
        absolutely certain (and right) that those restrictions exist in the
        applicable RFCs, AND that either those restrictions will remain for the
        indefinite future or there will be someone able to perform the necessary
        changes to your pages in a timely manner.

        One cannot fully check an E-address, anyway; I could put an invalid one
        on your form, send the form, and make the address valid later on; or
        /vice versa/. For all bar about 2% of the time, the validity of
        addresses @merlyn.dcu cannot be detected from outside this room.

        Your users presumably supply an E-address because they need to receive
        E-mail; getting it right is their responsibility, not yours.

        What you can reasonably do is to check that they have not forgotten to
        make an entry, and that they have not filled in the slot with something
        quite different. A test for the presence of <something>@<so mething>.<so
        mething> is suitable for that.

        IMHO, you should allow anything that can be put in a mailer's FROM line
        - for example, a full "Lady Ermintrude Q. Jones" <len.smith@btu. urg>
        or len.smith@btu.u rg (Sir Zerubbabel Jones, M.P.) are IIRC
        permissible; the comment field may be wanted at the recipient machine
        for internal routing.

        See <URL:http://www.merlyn.demo n.co.uk/js-valid.htm>.

        --
        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
        <URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
        <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
        <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

        Comment

        • rf

          #5
          Re: emails with 4 chars in suffix

          "Iain Downie" <iain.downie@bt o.org> wrote
          [color=blue]
          > Currently, I use a regexp to check on 'normal' emails with 3 chars.....[/color]

          Less than 5% of the people in the world live in a country that has email
          addresses ending with three characters.

          The rest of us have email addresses that end in things like .au (Australia),
          ..uk (the United Kingdom) etc.

          Am I not allowed to subscribe to your newsletter just because I live in
          Australia?

          That .coop you mention means IIRC co-operative. .info is also a valid TLD
          these days.

          --
          Cheers
          Richard.


          Comment

          • Michael Winter

            #6
            Re: emails with 4 chars in suffix

            On Tue, 11 Jan 2005 23:31:55 GMT, rf <rf@.invalid> wrote:

            [snip]
            [color=blue]
            > That .coop you mention means IIRC co-operative. .info is also a valid
            > TLD these days.[/color]

            So is museum. See <URL:http://www.iana.org/gtld/gtld.htm>.

            Mike

            --
            Michael Winter
            Replace ".invalid" with ".uk" to reply by e-mail.

            Comment

            • Grant Wagner

              #7
              Re: emails with 4 chars in suffix

              "rf" <rf@.invalid> wrote in message
              news:LlZEd.1146 39$K7.96632@new s-server.bigpond. net.au...[color=blue]
              > "Iain Downie" <iain.downie@bt o.org> wrote
              >[color=green]
              > > Currently, I use a regexp to check on 'normal' emails with 3[/color][/color]
              chars.....[color=blue]
              >
              > Less than 5% of the people in the world live in a country that has[/color]
              email[color=blue]
              > addresses ending with three characters.
              >
              > The rest of us have email addresses that end in things like .au[/color]
              (Australia),[color=blue]
              > .uk (the United Kingdom) etc.
              >
              > Am I not allowed to subscribe to your newsletter just because I live[/color]
              in[color=blue]
              > Australia?[/color]

              The original poster doesn't know what that regex does, by their own
              admission.

              It actually checks TLDs that are two or three letters:

              /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3 })+$/

              Note: {2,3}

              Suggested reading on the follies of validating E-mail addresses using a
              regular expression: <url:
              http://weblogs.asp.net/larryosterman...10/350135.aspx />.

              --
              Grant Wagner <gwagner@agrico reunited.com>
              comp.lang.javas cript FAQ - http://jibbering.com/faq


              Comment

              • Dr John Stockton

                #8
                Re: emails with 4 chars in suffix

                JRS: In article <8ySEd.139180$A L5.120363@twist er.nyroc.rr.com >, dated
                Tue, 11 Jan 2005 15:47:16, seen in news:comp.lang. javascript, Mick White
                <mwhite13BOGUS@ rochester.rr.co m> posted :[color=blue]
                >
                >(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6 })+$/
                >Allows suffix to be between 2 and 6 characters (inclusive)[/color]

                Rejects a$aa@bbb.cc which is a valid form of address.

                --
                © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                <URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
                <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                Comment

                • Dr John Stockton

                  #9
                  Re: emails with 4 chars in suffix

                  JRS: In article <LlZEd.114639$K 7.96632@news-server.bigpond. net.au>,
                  dated Tue, 11 Jan 2005 23:31:55, seen in news:comp.lang. javascript, rf
                  <rf@?.invalid > posted :[color=blue]
                  >"Iain Downie" <iain.downie@bt o.org> wrote
                  >[color=green]
                  >> Currently, I use a regexp to check on 'normal' emails with 3 chars.....[/color]
                  >
                  >Less than 5% of the people in the world live in a country that has email
                  >addresses ending with three characters.[/color]

                  His RegExp clearly allowed two or three; and he was looking to change
                  that part anyway.

                  By the way, which country are you thinking of? The USA has a proper
                  two-letter abbreviation, .us matching .uk & .au; and .com and .net are
                  in practice used world-wide.

                  --
                  © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                  <URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
                  <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                  <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                  Comment

                  • Matt Kruse

                    #10
                    Re: emails with 4 chars in suffix

                    Dr John Stockton wrote:[color=blue][color=green]
                    >> (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6 })+$/
                    >> Allows suffix to be between 2 and 6 characters (inclusive)[/color]
                    > Rejects a$aa@bbb.cc which is a valid form of address.[/color]

                    Who cares? Only trouble-makers generally use such obscure email addresses
                    anyway.

                    --
                    Matt Kruse



                    Comment

                    • Jim Ley

                      #11
                      Re: emails with 4 chars in suffix

                      On Thu, 13 Jan 2005 13:17:36 -0600, "Matt Kruse"
                      <newsgroups@mat tkruse.com> wrote:
                      [color=blue]
                      >Dr John Stockton wrote:[color=green][color=darkred]
                      >>> (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6 })+$/
                      >>> Allows suffix to be between 2 and 6 characters (inclusive)[/color]
                      >> Rejects a$aa@bbb.cc which is a valid form of address.[/color]
                      >
                      >Who cares? Only trouble-makers generally use such obscure email addresses
                      >anyway.[/color]

                      Lots of businesses have a lot of money from me due to not accepting
                      +'s in their email addresses. I may be a troublemaker, but I'm one
                      who spends a lot of cash online.

                      With GMail encouraging the + format I'm sure more people will be doing
                      it too.

                      Jim.

                      Comment

                      • Dr John Stockton

                        #12
                        Re: emails with 4 chars in suffix

                        JRS: In article <cs6hgj0cf6@new s3.newsguy.com> , dated Thu, 13 Jan 2005
                        13:17:36, seen in news:comp.lang. javascript, Matt Kruse
                        <newsgroups@mat tkruse.com> posted :[color=blue]
                        >Dr John Stockton wrote:[color=green][color=darkred]
                        >>> (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6 })+$/
                        >>> Allows suffix to be between 2 and 6 characters (inclusive)[/color]
                        >> Rejects a$aa@bbb.cc which is a valid form of address.[/color]
                        >
                        >Who cares? Only trouble-makers generally use such obscure email addresses
                        >anyway.[/color]

                        You are touchingly naive, and have a very limited understanding of
                        Internet operations. Fortunately, the evil-minded also seem to have a
                        limited understanding - most of them seem to be aiming at a matching
                        market - and the better-informed legitimate users can take advantage of
                        that.

                        Unless one is specifically aiming to restrict the addresses that one's
                        customers are allowed to use, one should be sure to accept all forms of
                        addresses permitted by the RFCs.

                        --
                        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME ©
                        Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
                        Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage of News.
                        No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

                        Comment

                        • Martin Bialasinski

                          #13
                          Re: emails with 4 chars in suffix

                          "Matt Kruse" <newsgroups@mat tkruse.com> wrote:
                          [color=blue]
                          > Dr John Stockton wrote:[color=green][color=darkred]
                          >>> (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6 })+$/
                          >>> Allows suffix to be between 2 and 6 characters (inclusive)[/color]
                          >> Rejects a$aa@bbb.cc which is a valid form of address.[/color][/color]
                          [color=blue]
                          > Who cares? Only trouble-makers generally use such obscure email
                          > addresses anyway.[/color]

                          Witness my address. I use a suffix for sorting purposes. With an own
                          domain like you have, you can have as much boxes as you like, but I am
                          restricted to this form.

                          Sometimes I am called a trouble-maker though. But this generally is by
                          people who don't like being disturbed by facts.

                          Comment

                          Working...