Java regex email

后端 未结 20 2500
清歌不尽
清歌不尽 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:47

    String emailRegex = "[a-zA-Z0-9_.]+@[a-zA-Z0-9]+.[a-zA-Z]{2,3}[.] {0,1}[a-zA-Z]+";
    Pattern.matches(emailRegex,"You_Input_Mail_Id");
    

    This is the regex to match valid email addresses.

提交回复
热议问题