How to verify an email address

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Richardson

    How to verify an email address

    In a FrontPage web I'm trying to validate an email address to be sure it
    meets some minimum format, perhaps something like ?@?.* I was told that
    this could be done in javascript. Any help would be very much appreciated.


  • WindAndWaves

    #2
    Re: How to verify an email address


    "Bob Richardson" <bobr at whidbey dot com> wrote in message
    news:1rqdnfloic HyZz3cRVn-3w@whidbeytel.c om...[color=blue]
    > In a FrontPage web I'm trying to validate an email address to be sure it
    > meets some minimum format, perhaps something like ?@?.* I was told that
    > this could be done in javascript. Any help would be very much appreciated.
    >
    >[/color]

    You can have a look at http://www.cem.co.nz/form/form.html, in the code you
    can find a test for an email address.

    Cheers

    Nicolaas


    Comment

    • Hywel Jenkins

      #3
      Re: How to verify an email address

      In article <1rqdnfloicHyZz 3cRVn-3w@whidbeytel.c om>, "Bob Richardson"
      <bobr at whidbey dot com> says...[color=blue]
      > In a FrontPage web I'm trying to validate an email address to be sure it
      > meets some minimum format, perhaps something like ?@?.* I was told that
      > this could be done in javascript. Any help would be very much appreciated.[/color]

      A simple search at Google would have given you loads of options:
      Try http://www.google.com/
      Seasrch for javascript email validation

      --
      Hywel

      Comment

      • MyndPhlyp

        #4
        Re: How to verify an email address


        "Bob Richardson" <bobr at whidbey dot com> wrote in message
        news:1rqdnfloic HyZz3cRVn-3w@whidbeytel.c om...[color=blue]
        > In a FrontPage web I'm trying to validate an email address to be sure it
        > meets some minimum format, perhaps something like ?@?.* I was told that
        > this could be done in javascript. Any help would be very much appreciated.[/color]

        Try this function. The RegExp might look a little strange, but if you take
        the time to hash it out it at least covers all the permutations I could
        think of at the time I wrote it. (Took a bit of work IIRC to wrap my mynd
        around it when I did it a couple years ago.) You might need to embellish it
        a bit to allow for the newer domain extensions.

        function isValidEmail(pa rmValue) {
        var rex = new
        RegExp("^[\\w\\+-]+(\\.[\\w\\+-]+)?@((\\d{1,3}\ \.\\d{1,3}\\.\\ d{1,3}\\.\\d{1
        ,3})\|([\\w\\+-]+\\.[a-zA-Z]{2,}))$");
        var pos = parmValue.searc h(rex);
        if (pos < 0) {
        return false;
        } else {
        return true;
        }
        }


        Comment

        • Dr John Stockton

          #5
          Re: How to verify an email address

          JRS: In article <CF8od.9003$Qh3 .7986@newsread3 .news.atl.earth link.net>,
          dated Sun, 21 Nov 2004 22:29:54, seen in news:comp.lang. javascript,
          MyndPhlyp <nobody@homerig ht.now> posted :[color=blue]
          >
          >"Bob Richardson" <bobr at whidbey dot com> wrote in message
          >news:1rqdnfloi cHyZz3cRVn-3w@whidbeytel.c om...[color=green]
          >> In a FrontPage web I'm trying to validate an email address to be sure it
          >> meets some minimum format, perhaps something like ?@?.* I was told that
          >> this could be done in javascript. Any help would be very much appreciated.[/color]
          >
          >Try this function. The RegExp might look a little strange, but if you take
          >the time to hash it out it at least covers all the permutations I could
          >think of at the time I wrote it. (Took a bit of work IIRC to wrap my mynd
          >around it when I did it a couple years ago.) You might need to embellish it
          >a bit to allow for the newer domain extensions.
          >
          >function isValidEmail(pa rmValue) {
          > var rex = new
          >RegExp("^[\\w\\+-]+(\\.[\\w\\+-]+)?@((\\d{1,3}\ \.\\d{1,3}\\.\\ d{1,3}\\.\\d{1
          >,3})\|([\\w\\+-]+\\.[a-zA-Z]{2,}))$");
          > var pos = parmValue.searc h(rex);
          > if (pos < 0) {
          > return false;
          > } else {
          > return true;
          > }
          >}[/color]

          The occurrence in code of such as
          if (pos < 0) { return false; } else { return true; }
          inevitably casts doubts upon the sagacity and understanding of the
          author, since
          return pos >= 0;
          suffices for the same purpose.


          When posting code to News, the posting agent should NOT be allowed to
          break code lines; it is the author's duty to avoid this.

          The code accepts a.a@b.cd, but rejects a.a.a@b.cd; AFAIK, both are
          valid.

          The code rejects my own address; I assume that its author has not
          studied the relevant Internet standards, and has little knowledge of the
          world outside his own unspecified country.



          OP : consider <URL:http://www.merlyn.demo n.co.uk/js-valid.htm#VEmA> ; you
          must mean *@*.* not ?@?.* .

          --
          © 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

          • MyndPhlyp

            #6
            Re: How to verify an email address


            "Dr John Stockton" <spam@merlyn.de mon.co.uk> wrote in message
            news:jm0UVbIYVd oBFwJE@merlyn.d emon.co.uk...[color=blue]
            >
            > The occurrence in code of such as
            > if (pos < 0) { return false; } else { return true; }
            > inevitably casts doubts upon the sagacity and understanding of the
            > author, since
            > return pos >= 0;
            > suffices for the same purpose.[/color]

            Po-ta-to versus po-tah-to. To-ma-to versus to-mah-to. Every programmer has
            their own style, and even that evolves over time. :-)

            [color=blue]
            >
            > When posting code to News, the posting agent should NOT be allowed to
            > break code lines; it is the author's duty to avoid this.[/color]

            The 'Net Police have yet to hand out fines. :-) Although I haven't been
            monitoring all the NGs, is it safe to assume you point that out to everybody
            that posts line breaks even for URLs?

            [color=blue]
            >
            > The code accepts a.a@b.cd, but rejects a.a.a@b.cd; AFAIK, both are
            > valid.[/color]

            AFAIK, "name.name.name .name.ad-nauseam" is also a valid prefix and domains
            with 4 (and more) parts are also to be expected. I would expect the
            standards to become even more flexible over time. The author admitted the
            RegExp may need tweaking to allow for today's permutations.

            [color=blue]
            >
            > The code rejects my own address; I assume that its author has not
            > studied the relevant Internet standards, and has little knowledge of the
            > world outside his own unspecified country.[/color]

            No facts in evidence regarding the author's knowledge of relevant Internet
            standards or of the world outside his own unspecified country. Careful or
            the 'Net Police will get you for unsubstantiated character assassination.
            :-)


            Truth be known, the code was written as a personal challenge to come up with
            a single RegExp for validating email addresses. At the time it was written,
            the so-called standards were just breaking out of the 8-character limitation
            on machine and account names. It hasn't been revisited in a very long time.
            The tweaks necessary are relatively minor once the reader understands the
            RegExp.


            Comment

            • Dr John Stockton

              #7
              Re: How to verify an email address

              JRS: In article <uMrod.9870$Qh3 .9552@newsread3 .news.atl.earth link.net>,
              dated Mon, 22 Nov 2004 20:14:18, seen in news:comp.lang. javascript,
              MyndPhlyp <nobody@homerig ht.now> posted :[color=blue]
              >
              >Truth be known, the code was written as a personal challenge to come up with
              >a single RegExp for validating email addresses. At the time it was written,
              >the so-called standards were just breaking out of the 8-character limitation
              >on machine and account names. It hasn't been revisited in a very long time.
              >The tweaks necessary are relatively minor once the reader understands the
              >RegExp.[/color]

              Right. So it was ancient trash not worth posting, since the OP can get
              better advice from others. The address of mine which it fails to accept
              has been in use for just over 9 years. The address I used earlier would
              also not have been accepted, for the same reason.


              Hywel - the trouble with your recommendation is that it is too likely to
              find rubbish, which the OP may not recognise as such.


              <FAQENTRY>IST M that it would be good to have an entry on RegExps for
              validation. Is the FAQ still being updated?

              --
              © John Stockton, Surrey, UK. ???@merlyn.demo n.co.uk Turnpike v4.00 MIME. ©
              Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
              Check boilerplate spelling -- error is a public sign of incompetence.
              Never fully trust an article from a poster who gives no full real name.

              Comment

              • MyndPhlyp

                #8
                Re: How to verify an email address


                "Dr John Stockton" <spam@merlyn.de mon.co.uk> wrote in message
                news:1tbhnwAmJ0 oBFwai@merlyn.d emon.co.uk...[color=blue]
                > JRS: In article <uMrod.9870$Qh3 .9552@newsread3 .news.atl.earth link.net>,
                > dated Mon, 22 Nov 2004 20:14:18, seen in news:comp.lang. javascript,
                > MyndPhlyp <nobody@homerig ht.now> posted :[color=green]
                > >
                > >Truth be known, the code was written as a personal challenge to come up[/color][/color]
                with[color=blue][color=green]
                > >a single RegExp for validating email addresses. At the time it was[/color][/color]
                written,[color=blue][color=green]
                > >the so-called standards were just breaking out of the 8-character[/color][/color]
                limitation[color=blue][color=green]
                > >on machine and account names. It hasn't been revisited in a very long[/color][/color]
                time.[color=blue][color=green]
                > >The tweaks necessary are relatively minor once the reader understands the
                > >RegExp.[/color]
                >
                > Right. So it was ancient trash not worth posting, since the OP can get
                > better advice from others. The address of mine which it fails to accept
                > has been in use for just over 9 years. The address I used earlier would
                > also not have been accepted, for the same reason.
                >
                >
                > Hywel - the trouble with your recommendation is that it is too likely to
                > find rubbish, which the OP may not recognise as such.[/color]

                At least I ventured, which is more than can be said for your "solution."


                Comment

                • Dr John Stockton

                  #9
                  Re: How to verify an email address

                  JRS: In article <odNod.11458$Qh 3.3350@newsread 3.news.atl.eart hlink.net>,
                  dated Tue, 23 Nov 2004 20:38:44, seen in news:comp.lang. javascript,
                  MyndPhlyp <nobody@homerig ht.now> posted :[color=blue]
                  >
                  >"Dr John Stockton" <spam@merlyn.de mon.co.uk> wrote in message
                  >news:1tbhnwAmJ 0oBFwai@merlyn. demon.co.uk...[color=green]
                  >> JRS: In article <uMrod.9870$Qh3 .9552@newsread3 .news.atl.earth link.net>,
                  >> dated Mon, 22 Nov 2004 20:14:18, seen in news:comp.lang. javascript,
                  >> MyndPhlyp <nobody@homerig ht.now> posted :[color=darkred]
                  >> >
                  >> >Truth be known, the code was written as a personal challenge to come up[/color][/color]
                  >with[color=green][color=darkred]
                  >> >a single RegExp for validating email addresses. At the time it was[/color][/color]
                  >written,[color=green][color=darkred]
                  >> >the so-called standards were just breaking out of the 8-character[/color][/color]
                  >limitation[color=green][color=darkred]
                  >> >on machine and account names. It hasn't been revisited in a very long[/color][/color]
                  >time.[color=green][color=darkred]
                  >> >The tweaks necessary are relatively minor once the reader understands the
                  >> >RegExp.[/color]
                  >>
                  >> Right. So it was ancient trash not worth posting, since the OP can get
                  >> better advice from others. The address of mine which it fails to accept
                  >> has been in use for just over 9 years. The address I used earlier would
                  >> also not have been accepted, for the same reason.[/color][/color]
                  [color=blue]
                  >At least I ventured, which is more than can be said for your "solution."[/color]

                  Presumably, therefore, you ignored the part aimed at the OP :-
                  [color=blue]
                  >OP : consider <URL:http://www.merlyn.demo n.co.uk/js-valid.htm#VEmA> ; ...[/color]

                  --
                  © John Stockton, Surrey, UK. ???@merlyn.demo n.co.uk Turnpike v4.00 MIME. ©
                  Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
                  Check boilerplate spelling -- error is a public sign of incompetence.
                  Never fully trust an article from a poster who gives no full real name.

                  Comment

                  • MyndPhlyp

                    #10
                    Re: How to verify an email address


                    "Dr John Stockton" <spam@merlyn.de mon.co.uk> wrote in message
                    news:EwF9AnBYtJ pBFwFn@merlyn.d emon.co.uk...[color=blue]
                    >[color=green]
                    > >At least I ventured, which is more than can be said for your "solution."[/color]
                    >
                    > Presumably, therefore, you ignored the part aimed at the OP :-
                    >[color=green]
                    > >OP : consider <URL:http://www.merlyn.demo n.co.uk/js-valid.htm#VEmA> ; ...[/color][/color]

                    Mere waving of the hands and banging of the gums void of a working solution
                    and lacking any substance greater than moist air passing over your lips
                    giving even more credence to the old adage: Those who can, do. Those who
                    can't, teach.


                    Comment

                    Working...