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
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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,692)