cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kavya2
Frequent Visitor

Need to restrict email address to have only one @ symbol in powerapps forms

hi @VDS_Mantra 

 

I am using below formula to validate an email in power apps forms but its not working. My motive is to throw error when some one enters in below format abc@gmail@yahoo.com

 

Kindly help !

 

Kavya2_0-1620843887448.png

If(And(IsMatch(DataCardValue7.Text,Email),Not(Find("(",DataCardValue7.Text)>0),Not(Find(")",DataCardValue7.Text)>0),Not(Find(",",DataCardValue7.Text)>0),Not(Find(":",DataCardValue7.Text)>0),Not(Find("<",DataCardValue7.Text)>0),Not(Find(">",DataCardValue7.Text)>0),Not(Find("[",DataCardValue7.Text)>0),Not(Find("]",DataCardValue7.Text)>0),Not(Find("\",DataCardValue7.Text)>0),Not(Find("@",DataCardValue7.Text)>2)),"Its a valid email address","Error! Enter a valid email address")

 

1 ACCEPTED SOLUTION

Accepted Solutions
DamoBird365
Community Champion
Community Champion

@Kavya2 try this ...

 

IsMatch(Result,"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}")

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

6 REPLIES 6
DamoBird365
Community Champion
Community Champion

@Kavya2 try this ...

 

IsMatch(Result,"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}")

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

No, its not working!

 

DamoBird365
Community Champion
Community Champion

Hi @Kavya2 

 

You'll have to be more specific with your feedback.  The above uses a regular expression which you can test here:

https://regex101.com/r/q36qx3/1

 

I cannot create emails with multiple @'s using this. 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

When I used your solution in powerapps, its not allowing to save the formula itself. Error as below. Please help.

Kavya2_0-1620898352305.png

 

Sharuk
Helper IV
Helper IV

Hi @Kavya2 , you need to wrap the formula given by @DamoBird365  with if , something like
if(Not(IsMatch(Result,"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}")),"Enter Valid Address")

Kavya2
Frequent Visitor

Yes, its worked now. 

Used the formula as below :

If(Not(IsMatch(DataCardValue5.Text,"[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]{2,}")), "Error! Enter a valid email address", "Valid email address")

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,221)