正则表达式用法整理

检验map中value是否含有负数:

Map<String,Integer> map=new HashMap<>();
		map.put("a", 1);
		System.out.println(map.values().toString());
		System.out.println(map.values().toString().matches("[\\[\\],0-9\\s]+"));

在正则表达式是想要匹配 [ ]或空白字符(\s)需要用 双斜杠 \ 双重转义

发布了9 篇原创文章 · 获赞 0 · 访问量 132

猜你喜欢

转载自blog.csdn.net/weixin_40151234/article/details/105299093