This regex example uses all the characters permitted by RFC 5322, which governs the email message format. Among the permitted characters are some that present a security risk if passed directly from user input to an SQL statement, such as the single quote (‘) and the pipe character (|). You should run your db queries with parameters or be sure to escape sensitive characters when inserting the email address into a string passed to another program, in order to prevent security holes such as SQL injection attacks.
B4X:
'Tests given string if it looks like an email address
Public Sub IsValidEmail(EmailAddress As String) As Boolean
Return Regex.IsMatch("^[\w!#$%&’*+/=?`{|}~^-]+(?:\.[\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,63}$", EmailAddress)
End Sub