Dear monk,

i have problem to make a validation on the email address, in my condition i need to let the user to key in their email account. This is the few restriction for the email address. e.g. aaa@aaa.com, aa.a@aa.com, aa.a@aa.net.uk-- this is a valide email address. the unvalid is like e.g @aaa.com , .aa@aa.com. So my checking is to check, if is a unvalid email address it will prompt a error message on the webpage for the invalid email address. This is the part of code i have done :

if (($aliasmailbox !~ /\@/) or ($aliasmailbox !~ /\./)) { &TaskLog("IMSModifyDetails sub::User's input not sufficient---a\n"); print $query->redirect("/cgi-bin/DisplayModifyDetails.cgi?&ErrorMsg2=I +NPUT3"); exit; } if ($aliasmailbox =~ /^\A[\@|\.]/) { &TaskLog("IMSModifyDetails sub::User's input not sufficient---b\n"); print $query->redirect("/cgi-bin/DisplayModifyDetails.cgi?ErrorMsg2=IN +PUT3"); exit; } *** if (($aliasmailbox =~ /\Z\@/) or ($aliasmailbox =~ /\Z\./)){ &TaskLog("IMSModifyDetails sub::User's input not sufficient---b\n"); print $query->redirect("/cgi-bin/DisplayModifyDetails.cgi?ErrorMsg2=IN +PUT3"); exit; } ***
The line of code which has been remark is to check that at the end position of the string there cannot be "@" or "." e.g. aaa@aa.aa. or aaa@aa.aa@ . any way this code does not work, can anyone fix it for me. from the 3 checking about only validate in one string must have @ and . also in the first position of the string cannot start with "@" or ".",

so how can i make a checking the it muct satisfiy that this validation is true aa.aa@aa.a.com and it become false when the email address is aa.aa@.aa.com--this is wrong after the allias must be charater not dot, any code for this . Can help to see this code which i have done but it totally check all the string where aaa@aa.com--true, else aa.aa@aa.com, aa@aa.aa.uk--- false. so how can i do this, when i need to check that the email address after the "@" cannot be ".". here is the validate code :

if ($aliasmailbox !~ /^.\@$@\.$/)
so what the suggesttion for this and the aa.aa@aa..com this also will return an error.

actually is there anything in perl got the function like Instr in vb, pr what the other way.

Edited 2001/06/28 by Ovid


In reply to How i can make a good user email cheking by Anonymous Monk

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.