如题所示。

解决方案 »

  1.   

    。比如www.baidu.com/(这里可以使所有的英语单词,但是不包括aaa).nsf
      

  2.   

    以前使用正则开发过类似自定义表达式解析运算的模块。大体思路:
    ·把要过滤的(也就是不包括的单词),输出成数组或集合的形式。
    ·使用替换的策略: strStr.replaceAll(filterArray[index],"");
    ·如果是true/false结果: strStr.match(filterArray[index].concat("?")); // 我没有测试
    ·总结来说就是把一个表达式拆成两个表达式。以上个人意见。。
      

  3.   

    以前使用正则开发过类似自定义表达式解析运算的模块。 大体思路: 
    ·把要过滤的(也就是不包括的单词),输出成数组或集合的形式。 
    ·使用替换的策略: strStr.replaceAll(filterArray[index],""); 
    ·如果是true/false结果: strStr.matches(filterArray[index].concat("?")); // 我没有测试 
    ·总结来说就是把一个表达式拆成两个表达式。 以上个人意见。。
      

  4.   


    String url = "www.baidu.com/aaaa.nsf";
    boolean b = Pattern.matches("www\\.baidu\\.com/(?!aaa\\.).+\\.nsf",url);
    System.out.println(b);
      

  5.   


    是不包括aaa,还是不能是aaa,也就是下面这个例子是否满足要求
    www.baidu.com/baaac.nsf//不能是aaa
    String pattern = "www\\.baidu\\.com/(?!aaa\\.)[^.]+\\.nsf";
    //不包括aaa
    String pattern = "www\\.baidu\\.com/(?:(?!aaa)[^.])+\\.nsf";