正则表达式匹配全角空格package test.regex; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SbcBlankRegexTest { final static String regex = "///*1//*/[//s|/u3000]*"; final static String regex2 = "[//s|/u3000]+"; static Pattern p = Pattern.compile(regex); public void test() { String s = "insert /*1*/ into x x x"; test(s); s = "insert/*1*/into/*1*/ xxx"; test(s); } private void test(String s) { Matcher matcher = p.matcher(s); while (matcher.find()) { System.out.println(s.substring(matcher.start())); } } private void buildPattern(String regex){ p = Pattern.compile(regex); } /** * @param args */ public static void main(String[] args) { SbcBlankRegexTest t = new SbcBlankRegexTest(); t.buildPattern(regex2); t.test(); } } 版权声明:本文为yhmhappy2006原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。原文链接:https://blog.csdn.net/yhmhappy2006/article/details/5548666