package comAPI;
import javax.swing.JOptionPane;
public class ZhengZhe {
public static void main(String[] args) {
String a= JOptionPane.showInputDialog(null,"请输入");
//String rex="[a-zA-Z\\u4e00-\\u9fa5]{2,10}";
String rex="(13|15|18)[0-9]{9}";
if(a.matches(rex)==true){
JOptionPane.showMessageDialog(null, "合法");
}else {
JOptionPane.showMessageDialog(null, "非法");
}
}
}
import javax.swing.JOptionPane;
public class ZhengZhe {
public static void main(String[] args) {
String a= JOptionPane.showInputDialog(null,"请输入");
//String rex="[a-zA-Z\\u4e00-\\u9fa5]{2,10}";
String rex="(13|15|18)[0-9]{9}";
if(a.matches(rex)==true){
JOptionPane.showMessageDialog(null, "合法");
}else {
JOptionPane.showMessageDialog(null, "非法");
}
}
}