cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
Super User
Super User

@Anonymous 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
Super User
Super User

@Anonymous 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 😉

Anonymous
Not applicable

No, its not working!

 

Hi @Anonymous 

 

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 😉

Anonymous
Not applicable

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 V
Helper V

Hi @Anonymous , 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")

Anonymous
Not applicable

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
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,433)