java正则表达式匹配电子邮件地址0608

java

package org.jimmy.studyproject.test;

import java.util.regex.Pattern;

public class Reg20200608 {

public static Pattern pattern = Pattern.compile("[a-zA-Z]([a-zA-Z]|[.])*@[a-zA-Z]+([.][a-zA-Z]+)+");

public static void main(String[] args) {

String email = "fgf.fg@dft.com";

System.out.println(pattern.matcher(email).matches());

email = "fgf.fg@dft.com.cn";

System.out.println(pattern.matcher(email).matches());

email = "fgffg@dft.com";

System.out.println(pattern.matcher(email).matches());

email = "fgffg@dft.com.cn";

System.out.println(pattern.matcher(email).matches());

email = ".fgffg@dft.com";

System.out.println(pattern.matcher(email).matches());

}

}

好了

以上是 java正则表达式匹配电子邮件地址0608 的全部内容, 来源链接: utcz.com/z/393103.html

回到顶部