正则表达式提取双引号之间的内容,当然了可以找到就可以实现替换了。
<code class="language-java">String str="this is /"Tom/" and /"Eric/", this is /"Bruce lee/", he is a chinese, name is /"李小龙/"。"; Pattern p=Pattern.compile("/"(.*?)/""); Matcher m=p.matcher(str); int i=0; while(m.find()) { str=str.replace(m.group(),""+(i++)); } System.out.println(str);</code>
以上这篇Java正则表达式,提取双引号中间的部分方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林网。
新闻热点
疑难解答