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 :
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 ".",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; } ***
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 :
so what the suggesttion for this and the aa.aa@aa..com this also will return an error.if ($aliasmailbox !~ /^.\@$@\.$/)
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |