Laura Pausini_It's Not Good Bye.mp3比如说这个字符串怎么用正则表达式完全匹配?
开始以为用\\w+\\.+mp3就可以了
但这里面有个空格,忽然之间不会了

解决方案 »

  1.   

    这叫匹配什么呀,没有一定的规则
    "Laura Pausini_It's Not Good Bye.mp3"也可以匹配的(\\w+ )+\\w+\\.mp3
      

  2.   

    import java.util.regex.*;
    public class TestHost { /**
     * @param args
     */
    public static void main(String[] args) throws Exception{
    // TODO Auto-generated method stub
    String s="Laura Pausini_It's Not Good Bye.mp3:";
    Pattern pa = Pattern.compile(".+\\.mp3");
    Matcher ma = pa.matcher(s);
    while(ma.find()){
    System.out.println(ma.group());
    }
    }
    }