首页 > 编程 > Java > 正文

Java正则表达式,提取双引号中间的部分方法

2019-11-26 09:48:31
字体:
来源:转载
供稿:网友

正则表达式提取双引号之间的内容,当然了可以找到就可以实现替换了。

<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正则表达式,提取双引号中间的部分方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表