正則表達式提取雙引號之間的內容,當然了可以找到就可以實現替換了。
<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正則表達式,提取雙引號中間的部分方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持VeVb武林網。
新聞熱點
疑難解答
圖片精選