You are here

PowerApps- Email validation formula checking for valid email format

This Formula can go into the "OnSelect" property of the save or submit button.

 

If(IsMatch(DATACARDNUMBER.Text, 
           "^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$"
   ),
   SubmitForm(FORMNAME),
   Notify("Email not valid", NotificationType.Error)
)

 

This formula can go into a label to use on your screen.

 

!IsBlank(DataCardValue3_8.Text) And !IsMatch(DataCardValue3_8.Text,"^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$")

 

Properties to change in Label:

Visible: !IsBlank(DataCardValue3_8.Text) And !IsMatch(DataCardValue3_8.Text,"^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$")

Text: "Email format incorrect! Must be name@example.com "

*** In the DataCardValue, in the field you want this message to show up... Change the "OnChange" property to false. This will allow changes on the screen as the user types in the field