cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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

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

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

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 

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

@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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (63,307)