用正则匹配EMail
用正则匹配EMail
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
import java.util.Scanner;
public class EMail {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String eMail = scan.nextLine();
System.out.println(eMail.matches("[\\w[.-]]+@[\\w[.-]]+\\.[\\w]+[\\.]?[\\w]+"));
}
}
编程路漫漫其修远兮,吾将上下而求索;
看我破茧而出,化身为龙\(^o^)/