如有一字符串[(te)-12.4(ch)-12.4(nol)-9(og)23.8(y )-12.1(()5.6(R)-3(E)-9.8(t)-1.2())-6.4( an)-12.4
(d w)9.1(a)-0.3(s)-8.1( th)-12.4(en )]
我只想得到()里的内容也就是
technology (REt) and was then 
主要是括号中的括号应该怎么处理?
请指教

解决方案 »

  1.   

    使用ANTLR进行文本解析或者使用正则表达式抽取
      

  2.   

    public static void main(String[] args) {
    String str = "[(te)-12.4(ch)-12.4(nol)-9(og)23.8(y )-12.1(()5.6(R)-3(E)-9.8(t)-1.2())-6.4( an)-12.4(d w)9.1(a)-0.3(s)-8.1( th)-12.4(en )]"; Pattern p = Pattern.compile("(\\()([\\w\\s\\(\\)]*)(\\))");
    Matcher m = p.matcher(str);
    while(m.find()){
    System.out.print(m.group(2));
    }
    }
      

  3.   

    弱弱的问一句,brightyq大神的方法,放在ActionScript里 应该如何写?
      

  4.   

    http://blog.csdn.net/thirdsmile/article/details/6129752
    这个是ActionScript正则表达式的应用方法,正则就用5L给你的,试试咯