web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Validate Emails (Text ...
Power Apps
Answered

Validate Emails (Text Input) Separated by Semicolon to Match Several Domains?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a text input for email addresses and the user can provide a single email or multiple emails separated by a semicolon.  I need to validate the email(s) to match 1 of 2 domains (abc.com or def.com).  My issue is that the code below works great, but how do I accomplish this validation for multiple emails separated by a semicolon?

// WORKS - Validate email text input as 1) Valid email, 2) Whitelist ABC & DEF domains 
If(IsMatch(TextInput1.Text, 
 "^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$"
 ) And
 Last(Split(TextInput1.Text, "@")).Result 
 in ["abc.com", "def.com"]
 ,
 Notify("Email IS valid", NotificationType.Success),
 Notify("Email not valid", NotificationType.Error)
)

 

Categories:
I have the same question (0)
  • Verified answer
    sgtsnacks Profile Picture
    62 on at

    You can use Split(string,delimiter) combined with a ForAll() to achieve this. You can also use the result to add to your notification to identify the address in question.

     

    Clear(mailtest);ForAll(Split(txt_Mails.Text,";").Result,
     If(IsMatch(ThisRecord.Result, 
     "^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$"
     ) And
     Last(Split(ThisRecord.Result, "@")).Result 
     in ["abc.com", "def.com"]
     ,
     Collect(mailtest,ThisRecord.Result & " is Valid");Notify(Last(mailtest.Value).Value,NotificationType.Success),
     Collect(mailtest,ThisRecord.Result & " is Not Valid");Notify(Last(mailtest.Value).Value,NotificationType.Error))
    )

     

    I've added a collection (mailtest) statement above to capture the results and display them in a ListBox, for demonstration purposes. This may not be required in production.

     

    sgtsnacks_0-1637085777654.png

    sgtsnacks_1-1637085815405.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @sgtsnacks - This worked - thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 519

#2
WarrenBelz Profile Picture

WarrenBelz 439 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 433

Last 30 days Overall leaderboard