请问要查找两个指定字符间所有字符该如何使用正则表达式,比如两个括号间(包含两个括号)

解决方案 »

  1.   

    字符1 = A
    字符2 = B"\\[^A]*A([^B]*)B" 
      

  2.   

    记事本似乎没有,word貌似有吧
    regex="A.*?B"
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;public class Test {
    public static void main(String[] args) {
    String input = "A12sdfc B Bscf  ddA dscd12   B ";
    Pattern p = Pattern.compile("A.*?B");
    Matcher m = p.matcher(input);
    while (m.find()) {
    System.out.println(m.group());
    }
    }
    }/*
    A12sdfc B
    A dscd12   B
    */
    以上是懒惰型 如果是贪婪的 就"A.*B"
      

  3.   

    我知道至少在 eclipse 和 dreamweaver 里面可以!