Android Code Snippet [B4X] Check Valid E-Mail Format

B4X:
Private Sub EmailAddressCheck(email As String) As Boolean   
    Return Regex.IsMatch("^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$",email)
End Sub
Example:
If EmailAddressCheck("[email protected]") = True Then
        Log("E-Mail is valid")
        Else
        Log("E-Mail is not valid")
    End If
 
Top