{"id":49685,"date":"2024-12-03T15:49:34","date_gmt":"2024-12-03T07:49:34","guid":{"rendered":"https:\/\/fwq.ai\/blog\/49685\/"},"modified":"2024-12-03T15:49:34","modified_gmt":"2024-12-03T07:49:34","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%8c%b9%e9%85%8d%e6%ad%a3%e5%a5%bd%e4%b8%89%e4%b8%aa%e8%bf%9e%e7%bb%ad%e6%95%b0%e5%ad%97%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/49685\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff1f <\/h1>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241031\/1730384844672393cc8a8d8.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff1f\u63d2\u56fe\" \/><\/p>\n<p>\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\uff0c\u9700\u8981\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff0c\u9650\u5236\u6761\u4ef6\u662f\u4e0d\u5f97\u5c11\u4e8e\u6216\u591a\u4e8e\u4e09\u4e2a\u6570\u5b57\u3002\u4e0b\u9762\u63d0\u4f9b\u4e00\u4e2a\u4fee\u6539\u540e\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/p>\n<pre>(?&lt;!\\d)(\\d{3})(?!\\d)<\/pre>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>(?&lt;!d)\uff1a\u8d1f\u5411\u524d\u67e5\u627e\uff0c\u786e\u4fdd\u6570\u5b57\u540e\u9762\u6ca1\u6709\u6570\u5b57\u3002<\/li>\n<li>d{3}\uff1a\u5339\u914d\u4e09\u4e2a\u6570\u5b57\u3002<\/li>\n<li>(?!d)\uff1a\u8d1f\u5411\u540e\u67e5\u627e\uff0c\u786e\u4fdd\u6570\u5b57\u524d\u9762\u6ca1\u6709\u6570\u5b57\u3002<\/li>\n<\/ul>\n<p>\u8ba9\u6211\u4eec\u4f7f\u7528 python \u4ee3\u7801\u793a\u4f8b\u6765\u8bf4\u660e\u5982\u4f55\u4f7f\u7528\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/p>\n<pre>import re\n\ndata = [\n    '123',\n    '123u',\n    'u123',\n    'x123y',\n    '1234',\n    'x1234y',\n    '12',\n    '123y456',\n]\n\nfor s in data:\n    print(re.findall(r'(?&amp;lt;!\\d)(\\d{3})(?!\\d)', s))<\/pre>\n<p>\u8f93\u51fa\uff1a<\/p>\n<pre>['123']\n['123']\n['123']\n['123']\n[]\n[]\n[]\n['123', '456']<\/pre>\n<p>\u4eca\u5929\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff1f \u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff1f \u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\uff0c\u9700\u8981\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff0c\u9650\u5236\u6761\u4ef6\u662f\u4e0d\u5f97\u5c11\u4e8e\u6216\u591a\u4e8e\u4e09\u4e2a\u6570\u5b57\u3002\u4e0b\u9762\u63d0\u4f9b\u4e00\u4e2a\u4fee\u6539\u540e\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a (?&lt;!\\d)(\\d{3})(?!\\d) \u5176\u4e2d\uff1a (?&lt;!d)\uff1a\u8d1f\u5411\u524d\u67e5\u627e\uff0c\u786e\u4fdd\u6570\u5b57\u540e\u9762\u6ca1\u6709\u6570\u5b57\u3002 d{3}\uff1a\u5339\u914d\u4e09\u4e2a\u6570\u5b57\u3002 (?!d)\uff1a\u8d1f\u5411\u540e\u67e5\u627e\uff0c\u786e\u4fdd\u6570\u5b57\u524d\u9762\u6ca1\u6709\u6570\u5b57\u3002 \u8ba9\u6211\u4eec\u4f7f\u7528 python \u4ee3\u7801\u793a\u4f8b\u6765\u8bf4\u660e\u5982\u4f55\u4f7f\u7528\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a import re data = [ &#8216;123&#8217;, &#8216;123u&#8217;, &#8216;u123&#8217;, &#8216;x123y&#8217;, &#8216;1234&#8217;, &#8216;x1234y&#8217;, &#8217;12&#8217;, &#8216;123y456&#8242;, ] for s in data: print(re.findall(r'(?&amp;lt;!\\d)(\\d{3})(?!\\d)&#8217;, s)) \u8f93\u51fa\uff1a [&#8216;123&#8217;] [&#8216;123&#8217;] [&#8216;123&#8217;] [&#8216;123&#8217;] [] [] [] [&#8216;123&#8217;, &#8216;456&#8217;] \u4eca\u5929\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6b63\u597d\u4e09\u4e2a\u8fde\u7eed\u6570\u5b57\uff1f \u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-49685","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=49685"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/49685\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=49685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=49685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=49685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}