java中常用正则表达式

2018-06-08  本文已影响0人  寇寇寇先森
String [] tags=text.split("[\\,, \\\\]");
boolean flag = text.matches(".*[\\,, ]+.*");
boolean matches = text.matches(".*[\\(\\) (\\) ]+.*");
boolean matchesa = text.matches(".*[\\,,(\\) (\\) ]+.*");
boolean f = text.matches("^[0-9]*$");
String regEx=".*[\\~!@#$%^&*()+=|{}':;',.<>/?~!#¥%……&*()——+|{}【】\\[\\].‘;:”“’。,、?]+.*";
String r2="[A-Z a-z 0-9_]";
String r3="[^A-Z a-z 0-9_]"; 
boolean flag=string.matches("^(\\d[-])+\\d$");

暂时常用的这些,待续!

上一篇下一篇

猜你喜欢

热点阅读