对于字符串 s
1、判断是否全部是数字
Pattern partGood = Pattern.compile("^//D+");
Matcher mPartGood = partGood.matcher(strContent);
if(!mPartGood.find()){
...
}
2、判断1111.11格式
Pattern allGood = Pattern.compile("^//d{4,}//.//d{2,}");
Matcher mAllGood = allGood.matcher(strContent);
if (mAllGood.find()){
...
}
部分正则表达式
最新推荐文章于 2021-01-25 18:06:44 发布