正则表达式匹配不包含某些字符串

  正则表达式匹配不包含某些字符串:

  ^((?!@).)*$   //如果包含@字符串会被匹配处理

public static void main(String[] args){
        String reg = "^((?!@).)*$";
        System.out.println("gdfgfgdffgn".matches(reg));
    }

  字符串不包含@,返回true

原文地址:https://www.cnblogs.com/senlinyang/p/8651884.html