cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AkshayManke
Responsive Resident
Responsive Resident

Adding Validation For Custom Email

Hello,

 

I want to add a validation that the user must enter the email like 'AB123@domain.com'. I checked IsMatch references but i am not able to customize the entire email ID in the required manner. Can anyone please help for the same?

 

Also is there any instant expression generator available based on the input given? So that we can just tell the example and it will convert it in to the expression?

 

Many Thanks,

Akshay

2 ACCEPTED SOLUTIONS

Accepted Solutions
AkshayManke
Responsive Resident
Responsive Resident

Hello @mdevaney,

 

I got a very simple solution. Used below code.

If(IsMatch(TextInput2.Text, "[A-Za-z]{2}[0-9]{3}@domain.com"), "Valid", "Not Valid")

 

This is working as expected. But still you can share any best workaround. 🙂

 

Thanks,

Akshay

View solution in original post

@AkshayManke 

Your most recent posts have helped me to understand you also wanted to validate the numbers as well.  That's one reason why it wasn't working as expected.

The regular expression will work fine.  However, here's another way to write it that you don't have to learn regular expressions for.

 

If(
    IsMatch(
        TextInput2.Text,
        Match.Letter & Match.Letter & Match.Digit & Match.Digit & Match.Digit & "@domain.com"
    ),
    "Valid",
    "Not Valid"
)

 

 

 

 

Please Accept both of our solutions: yours and mine as the answer here 🙂

View solution in original post

7 REPLIES 7
mdevaney
Super User III
Super User III

@AkshayManke

You can check for a valid email like this:

IsMatch("AB123@domain.com", Match.Email)

 

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

AkshayManke
Responsive Resident
Responsive Resident

Hello @mdevaney,

 

Actually i can validate an email using Match.Email function but i specifically need a validation to check the email in this format.

 

AB123@domain.com

 

More details as below.

First 2 Letters  = AB

Then 3 Number = 123

The @ Symbol = @

Then domain name = domain.com

 

Hence the complete email ID would be AB123@Domain.com.

 

Thanks,

Akshay

@AkshayManke 

Adding a few more validations like this will do the trick.

 

With(
    {varEmail: "AB123@domain.com"},
    Left(varEmail,2)="AB"
    And Right(varEmail, 9)="domain.com"
    And IsMatch(varEmail, Match.Email)
)

 

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

AkshayManke
Responsive Resident
Responsive Resident

Hello @mdevaney,

 

I am trying to corelate it but not getting clearly.

 

Lets have one example. I have added TextInput2. If the Email is in the correct format then then the fill property should be while else green.

 

How to apply your given formula to it?

 

Thanks,

Akshay 

AkshayManke
Responsive Resident
Responsive Resident

Hello @mdevaney,

 

I got a very simple solution. Used below code.

If(IsMatch(TextInput2.Text, "[A-Za-z]{2}[0-9]{3}@domain.com"), "Valid", "Not Valid")

 

This is working as expected. But still you can share any best workaround. 🙂

 

Thanks,

Akshay

View solution in original post

@AkshayManke 

Your most recent posts have helped me to understand you also wanted to validate the numbers as well.  That's one reason why it wasn't working as expected.

The regular expression will work fine.  However, here's another way to write it that you don't have to learn regular expressions for.

 

If(
    IsMatch(
        TextInput2.Text,
        Match.Letter & Match.Letter & Match.Digit & Match.Digit & Match.Digit & "@domain.com"
    ),
    "Valid",
    "Not Valid"
)

 

 

 

 

Please Accept both of our solutions: yours and mine as the answer here 🙂

View solution in original post

AkshayManke
Responsive Resident
Responsive Resident

@mdevaney,

 

Yes you are right the below code also will give the same result.

If(
    IsMatch(
        TextInput2.Text,
        Match.Letter & Match.Letter & Match.Digit & Match.Digit & Match.Digit & "@domain.com"
    ),
    "Valid",
    "Not Valid"
)

Anyways, i am accepting both as solutions now 🙂. Still Many Thanks for your help.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (99,776)