JAVA
import java.util.regex.Pattern;
Pattern p = Pattern.compile("^[A-Za-z]+$");
System.out.println(p.matcher(firstname).find());//匹配成功true 否则 false
JS
var pattern= /^[a-zA-Z0-9]*$/;
pattern.test(psptId);// 匹配成功true 否则 false
Python import re matchObj = re.match( r'[A-Za-z]+',firstname) if matchObj: print "matchObj.group() : ",matchObj.group() else: #None print "No match!!"
import java.util.regex.Pattern;
Pattern p = Pattern.compile("^[A-Za-z]+$");
System.out.println(p.matcher(firstname).find());//匹配成功true 否则 false
JS
var pattern= /^[a-zA-Z0-9]*$/;
pattern.test(psptId);// 匹配成功true 否则 false
Python import re matchObj = re.match( r'[A-Za-z]+',firstname) if matchObj: print "matchObj.group() : ",matchObj.group() else: #None print "No match!!"