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

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

@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!

 

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

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,144)