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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,934)