Java regex email

后端 未结 20 2440
清歌不尽
清歌不尽 2020-11-22 13:09

First of all, I know that using regex for email is not recommended but I gotta test this out.

I have this regex:

\\b[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]         


        
20条回答
  •  一整个雨季
    2020-11-22 13:32

    I have tested this below regular expression for single and multiple consecutive dots in domain name -

    ([A-Za-z0-9-_.]+@[A-Za-z0-9-_]+(?:\.[A-Za-z0-9]+)+)
    

    and here are the examples which were completely fulfilled by above regex.

    End_user@live.com
    End.u@exm-tech.net
    enduser9876@gmail.in
    end_user@mywebsite.ac.in.gui
    Another984.User2@mail.edu.sg
    Another987_User5@mail.show.au
    Slow_User@example_domain.au.in
    iamthemostsimpleremailhere@example.com
    

    I have tried to cover maximum commonly used email id's validation by this above illustrated regex and yet working...

    If you still know some consequentially used email id's had left here, please let me know in comment section!

提交回复
热议问题