日期:2014-05-20 浏览次数:20792 次
import java.util.regex.Pattern;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "20131210_19045.csv,a.csv,";
System.out.println(""+Pattern.matches("(\\w*?\\W*?)*?(\\w?_\\d{4}.csv,)+(\\w*?\\W*?)*?", str));
}
}
String str = "20131210_19015.csv,a.csv,";
System.out.println(""+Pattern.matches(".*(?<=_)(\\d{4})(?=.csv).*", str));
String str = "20131210_19045.csv,a.csv,";
System.out.println(str.matches(".*_\\d{4}\\.csv.*"));
@Test
public void test()
{
String str = "20131210_19015.csv,a.csv,";
System.out.println(""+Pattern.matches(".*_\\d{4,}+\\.csv.*", str));
}