String reg = "^(?:(?!(abc|def)).)*$"
不包含abc或def的字符串
java使用match和pattern来实现判断字符串是否不含有某个字符,实例如下:
/*** 判断字符串是否数值
* @param str
* @return true:是数值 ;false:不是数值
* @author:WD_SUHUAFU
*/
private boolean isNumber(String str)
{
Pattern pattern = Pattern.compile("^[0-9]+(.[0-9]*)?$")
Matcher match=pattern.matcher(str)
return match.matches()
}