I'm sorry if this sounds like I'm annoyed with you; I'm not, but this is a pet peeve of mine. Really. I'm trying very hard not to rant.

Whatever you do, make sure that it supports (at least) all valid email addresses, which your regex doesn't. Read the RFCs. Many people assume that the left side of the "@" is as restricted as the right side. It isn't so. Among the many discussions, please see http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address?rq=1

It really annoys me to run into some web-site which won't let me enter a perfectly valid email address because someone has done as you're trying to do and botched it, as you're probably going to do. No offence intended; an email address is a non-trivial thing to parse.

By saying in effect "I'm not allowed to use CPAN", you're depriving yourself of one of the major reasons to use perl, and inviting errors in implementation. If you're not allowed to install CPAN modules system-wide, there are lots of ways to install them for a project, ending with copy/paste the code from CPAN.


In reply to Re^3: input - E-mail address - how to check string ? by thargas
in thread input - E-mail address - how to check string ? by zalezny

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.