cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
u4jaanus
Resolver I
Resolver I

TO Email TextField Validations

Hi,

Trying to validate Text Field so I could use it to Pick Recipient Email address. I manage to validate it using regular Expressions however unable to finish it as I want.
regularExpression I have used is. 

^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})\$

This work fine for the email part but when I try to add more addresses in same text field i.e.
contos@contos.com; contos@contos.com ...
I am getting mismatch; any idea how to validate all email addresses and to make it mandatory to use ; if there is more than one email address OR if replace [SPACE] with ;SPACE to format it properly as user can send emails to multiple recipients this way.

Thank you

2 REPLIES 2
mdevaney
Super User
Super User

@u4jaanus 

Regular expressions are actually not necessary to validate an email in PowerApps.  You can do this in a simpler way

 

IsMatch(“yourname@your company.com”, Match.Email)

 

To determine if all emails in a string are valid you can use this comparison.  It asks: how many valid emails and does it match the total emails supplied.

 

CountRows(Filter(AddColumns(Split(“yourname1@yourcompany.com; yourcompany2@yourcompany.com”, “; “), “IsEmail”, IsMatch(Result, Match.Email))), IsEmail=true)=CountRows(Split(“yourname1@yourcompany.com; yourcompany2@yourcompany.com”, “; “))

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

I used regular Expression and This is what I did

IsMatch(EmailTextField.text,"^(([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)(\s*;\s*|\s*$))*$"),"Use ' ; ' if adding multiple email address", "Invalid 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.

Top Solution Authors
Top Kudoed Authors
Users online (2,035)