0
votes
public function validemail(email:String):Boolean {
    //var emailExpression:RegExp = /^[\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$;
    //var Result:Object=emailExpression.exec(email);

    var pattern1:RegExp  =/^[\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$;
    var Result:Object =pattern1.exec(email);
    if(Result==null){
        return false;
    }
    return true;                
}
public function validateandsend(event:MouseEvent):void {
    if(validemail(txtEmail)==false){
        ErrorMessage="Please enter the valid mail di information";
        xmlErrorDetails.send();
        return;
    }
}

For the code above when I compile the Error is :

Multiple markers at this line: -1084: Syntax error: expecting identifier before var. -1086: Syntax error: expecting semicolon before colon. -Result

Receiving the Error please help

1
Receing the Error at the two lines var pattern1:RegExp =/^[\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$; var Result:Object =pattern1.exec(email); - Abdul Raheem Mohammad
your regexp is missing a / - Marton Pallagi

1 Answers

2
votes

You are missing a closing / at the end of the line. It should read:

var pattern1:RegExp = /^[\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$/;