我想从[[indicator1]]+[[expression2]]+[[label2]]中获得indicator1、expression2、label2我用了正则:attern p = Pattern.compile("\\[\\*\\]\\]");结果不行......高手指点 

解决方案 »

  1.   

    "[[indicator1]]+[[expression2]]+[[label2]]".split("[^\\w]+")  这样就可以了
      

  2.   

    "[[indicator1]]+[[expression2]]+[[label2]]".split("[^\\w]+") 
      

  3.   


    public static void main(String[] args) {
    String str = "[[indicator1]]+[[expression2]]+[[label2]]";
    Matcher m = Pattern.compile("\\[\\[(.*?)\\]\\]").matcher(str);
    while(m.find()){
    System.out.println(m.group(1));
    }
    }