假设你想要单引号之间的部分,请将此正则表达式与一起使用Matcher:
"'(.*?)'"
例:
String mydata = "some string with 'the data i want' inside";Pattern pattern = Pattern.compile("'(.*?)'");Matcher matcher = pattern.matcher(mydata);if (matcher.find()){ System.out.println(matcher.group(1));}
结果:
the data i want
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)