{"id":38882,"date":"2023-12-11T14:45:46","date_gmt":"2023-12-11T06:45:46","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=38882"},"modified":"2023-12-11T14:45:46","modified_gmt":"2023-12-11T06:45:46","slug":"%e8%af%b7%e4%bd%a0%e8%b0%88%e8%b0%88java%e4%b8%ad%e6%98%af%e5%a6%82%e4%bd%95%e6%94%af%e6%8c%81%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e6%93%8d%e4%bd%9c%e7%9a%84%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/11\/%e8%af%b7%e4%bd%a0%e8%b0%88%e8%b0%88java%e4%b8%ad%e6%98%af%e5%a6%82%e4%bd%95%e6%94%af%e6%8c%81%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e6%93%8d%e4%bd%9c%e7%9a%84%ef%bc%9f\/","title":{"rendered":"\u8bf7\u4f60\u8c08\u8c08Java\u4e2d\u662f\u5982\u4f55\u652f\u6301\u6b63\u5219\u8868\u8fbe\u5f0f\u64cd\u4f5c\u7684\uff1f"},"content":{"rendered":"<p>&#8220;`&#8221;                    \u8003\u5bdf\u70b9\uff1a\u6b63\u5219\u8868\u8fbe\u5f0f<\/p>\n<p>Java\u4e2d\u7684String\u7c7b\u63d0\u4f9b\u4e86\u652f\u6301\u6b63\u5219\u8868\u8fbe\u5f0f\u64cd\u4f5c\u7684\u65b9\u6cd5\uff0c\u5305\u62ec\uff1amatches()\u3001replaceAll()\u3001replaceFirst()\u3001split()\u3002\u6b64\u5916\uff0cJava\u4e2d\u53ef\u4ee5\u7528Pattern\u7c7b\u8868\u793a\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684API\u8fdb\u884c\u5404\u79cd\u6b63\u5219\u8868\u8fbe\u5f0f\u64cd\u4f5c\uff0c\u5982\uff1a<\/p>\n<p>&lt;pre&gt;&lt;code class=&quot;&quot;language-java&quot;&quot; lang=&quot;&quot;java&quot;&quot;&gt;import java.util.regex.Matcher;<br \/>\nimport java.util.regex.Pattern;<br \/>\nclass RegExpTest {<br \/>\n    public static void main(String[] args) {<br \/>\n        String str = &quot;&quot;\u6210\u90fd\u5e02(\u6210\u534e\u533a)(\u6b66\u4faf\u533a)(\u9ad8\u65b0\u533a)&quot;&quot;;<br \/>\n        Pattern p = Pattern.compile(&quot;&quot;.*?(?=\\\\()&quot;&quot;);<br \/>\n        Matcher m = p.matcher(str);<br \/>\n        if(m.find()) {<br \/>\n            System.out.println(m.group());<br \/>\n        }<br \/>\n    }<br \/>\n}<br \/>\n&lt;\/code&gt;&lt;\/pre&gt;<\/p>\n<p>\u00a0<\/p>\n<p>&lt;pre&gt;&lt;code&gt;            &quot;&#8220;`<br \/>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;`&#8221; \u8003\u5bdf\u70b9\uff1a\u6b63\u5219\u8868\u8fbe\u5f0f Java\u4e2d\u7684String\u7c7b\u63d0\u4f9b\u4e86\u652f\u6301\u6b63\u5219\u8868\u8fbe\u5f0f\u64cd\u4f5c\u7684\u65b9\u6cd5\uff0c [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-38882","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/38882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=38882"}],"version-history":[{"count":1,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/38882\/revisions"}],"predecessor-version":[{"id":38883,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/38882\/revisions\/38883"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=38882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=38882"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=38882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}