String s = "abcdefg";
System.out.println(s.replaceAll("\\[URL\\](.*)\\[/URL\\]", "$1"));

解决方案 »

  1.   

    中间的值是固定的还是随机的。
    固定的:
    str.substring(5,11);
    随机的:
    for(int i=5;i<str.length();i++ )
    {
       if(str.substring(i).equals("[/URL]"))
       {
          str = str.substring(5,i);
       }
    }
    str 就是你要的值了。
      

  2.   

    请问这个"$1"是什么意思?
    replaceAll不是替换的功能吗?
      

  3.   

    replaceAll 是正则表达式表示的替换字符串
    在第一个参数中用 () 括起来的部分可以用在第二个参数中,用 $1...$9 来代替,依次数就是了
      

  4.   

    用INDEXOF()最好用,lastindexof();
    String str="abcdefg";
    String sStr = str.subString(str.indexof("")+5,str.indexof(""));
    试试吧,indexof()就是提子串的,有重载,lastindexof()..
      

  5.   

    先结贴,再散分,就会告诉你了.不要坏了csdn的规矩哟。不行就在javadoc里面找吧.