question

AypnCNN-4494 avatar image
0 Votes"
AypnCNN-4494 asked YijingSun-MSFT commented

Getting email ID with First & Second Name along with specfic domain names.

Hi,

I wanna get email ID from clients with spefic validations,

Email id should be in first and sencond names with middle one dot combination along with specfic domain names

for Example:
murugan.doss@abcpvt.in
ramu.gopal@xyz.in
joseph.amal@edc.co.in
sami.akbar@xyz.in

Note:
1. Im developing apps by using Aspx . VB .net
2.This validation should be in Jquery with Aspx.vb
3.Numbers and _ and . are allowed.

Thanks in advance.

dotnet-aspnet-general
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Are you looking to validate a standard email address or something more in depth? Can you clarify the use case? Keep in mind, ASP.NET regex validation control has an email validation option. If the Regex does not fit your requirement then you can simple do a Google search for a Regex that meets your expectation.

Anyway, at least try to write the code...

0 Votes 0 ·

Hi,

Yes, you're correct, email id name should contains one dot (.) and email id name starts with alphabets only, length would be minimum 5 chars and it is end with preferred domain names, all small letters, as I mentioned.

As like this...

kumar.sankar@abcpvt.in
sabira.vs1@xyz.in

0 Votes 0 ·

You have a lot of posts and experience on these forums. Is there some logical reason you are unable to at least try to write the code? Again, I assume this is a Web Forms question and validation controls come standard with email validation. If the Regex does not meet your expectation then do a Google search for a Regex that does meet your expectations.

Use an online Regex tester to verify the Regex works as expected.

https://regex101.com/
https://regex101.com/library?orderBy=RELEVANCE&search=email

If this is an MVC question then learn model validation. MVC uses jQuery unobtrusive validation and also has built-in email validation.

If you need a jQuery solution then the community needs to know a bit more about your code. What version of jQuery are you using? Are you using the standard jQuery validation? Are you building a custom solution?

and it is end with preferred domain names,

What does "end with preferred domain names" mean? Again, please try to write the code on you own first. doing so helps us to help you. otherwise, we're guessing how your code is supposed to work.

Edit: jQuery Regex validation tutorial.

https://wisdmlabs.com/blog/real-time-form-validation-using-regular-expressions-jquery/




0 Votes 0 ·

1 Answer

YijingSun-MSFT avatar image
0 Votes"
YijingSun-MSFT answered YijingSun-MSFT commented

Hi @AypnCNN-4494 ,

email id name should contains one dot (.) and email id name starts with alphabets only, length would be minimum 5 chars and it is end with preferred domain names, all small letters,

According to your description, I have two questions of your descriptions.

  1. what's the preferred domain names?

  2. which words' length are minimum 5 chars? Before @?

Now, I have do a test to meet 3 requirements.
1.contains one dot (.)

 ([a-z0-9_.])+\.

2.starts with alphabets only

 [a-z]

3.all small letters

  [a-z]

The complete regex with the 3 requirements:

 /^(([a-z])+([a-z0-9_.])+\.)+([a-z])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9])+$/

Best regards,
Yijing Sun


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi

  1. What's the preferred domain names?
    For Security purpose, I shared dummy domain names, we can use like @abc.co.in @xml.com ...

Thanks for the response.



0 Votes 0 ·

Hi @AypnCNN-4494 ,
Do you have rules of your domain names?All small letters?

Best regards,
Yijing Sun

0 Votes 0 ·