{"id":3852,"date":"2024-11-10T12:03:51","date_gmt":"2024-11-10T04:03:51","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3852\/"},"modified":"2024-11-10T12:03:51","modified_gmt":"2024-11-10T04:03:51","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%e6%8f%90%e5%8f%96%e5%ad%97%e7%ac%a6%e4%b8%b2%e4%b8%ad%e7%9a%84%e5%89%8d%e5%87%a0%e4%b8%aa%e5%ad%97%e6%af%8d%e5%ad%97","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3852\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173115333790586.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u4ece\u5b57\u7b26\u4e32\u4e2d\u63d0\u53d6\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26<\/strong><\/p>\n<p>\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u7531\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26\u548c\u540e\u51e0\u4e2a\u6570\u5b57\u5b57\u7b26\u7ec4\u6210\u7684\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u6bcd\u5b57\u7b26\u3002<\/p>\n<p>\u95ee\u9898\u63cf\u8ff0\u5982\u4e0b\uff1a<\/p>\n<p>\u5df2\u77e5\u5b57\u7b26\u4e32\u5177\u6709\u7279\u5b9a\u683c\u5f0f\uff0c\u524d 2 \u81f3 4 \u4e2a\u5b57\u7b26\u4e3a\u5b57\u6bcd\uff0c\u540e\u8ddf\u81f3\u5c11 1 \u4e2a\u6570\u5b57\uff0c\u603b\u957f\u5ea6\u4e0d\u8d85\u8fc7 7 \u4e2a\u5b57\u7b26\u3002\u9700\u8981\u4f7f\u7528 javascript \u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u63d0\u53d6\u8fd9\u4e9b\u5b57\u6bcd\u5b57\u7b26\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<p>\u4ee5\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u4ee5\u7528\u4e8e\u5339\u914d\u6307\u5b9a\u7684\u683c\u5f0f\u5e76\u63d0\u53d6\u5b57\u6bcd\u5b57\u7b26\uff1a<\/p>\n<pre>\/(^s.*?)d\/<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d\uff1a<\/p>\n<ul>\n<li>^\uff1a\u5339\u914d\u5b57\u7b26\u4e32\u5f00\u5934<\/li>\n<li>s\uff1a\u5339\u914d\u975e\u7a7a\u683c\u5b57\u7b26<\/li>\n<li>.*?\uff1a\u8d2a\u5a6a\u5339\u914d\u540e\u9762\u5c3d\u53ef\u80fd\u77ed\u7684\u5b50\u5e8f\u5217<\/li>\n<li>d\uff1a\u5339\u914d\u6570\u5b57\u5b57\u7b26<\/li>\n<\/ul>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5de5\u4f5c\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>^ \u786e\u4fdd\u5339\u914d\u4ece\u5b57\u7b26\u4e32\u5f00\u5934\u5f00\u59cb\u3002<\/li>\n<li>s \u5339\u914d\u975e\u7a7a\u683c\u5b57\u7b26\uff0c\u8fd9\u610f\u5473\u7740\u5b57\u6bcd\u5b57\u7b26\u7684\u4f4d\u7f6e\u3002<\/li>\n<li>.*? \u7136\u540e\u5c3d\u53ef\u80fd\u77ed\u5730\u5339\u914d\u540e\u9762\u7684\u5b57\u6bcd\u5b57\u7b26\u3002<\/li>\n<li>d \u5339\u914d\u968f\u540e\u7684\u6570\u5b57\u5b57\u7b26\uff0c\u6307\u793a\u5b57\u6bcd\u5b57\u7b26\u7ed3\u675f\u7684\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<p>\u4f7f\u7528\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u63d0\u53d6\u5b57\u6bcd\u5b57\u7b26\uff1a<\/p>\n<pre>const str = \"ASW45687\";\nconst match = str.match(\/(^S.*?)d\/);\nconst letters = match[1];<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0cletters \u5c06\u5305\u542b\u63d0\u53d6\u7684\u5b57\u6bcd\u5b57\u7b26 &#8220;asw&#8221;\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ece\u5b57\u7b26\u4e32\u4e2d\u63d0\u53d6\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26 \u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u7531\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26\u548c\u540e\u51e0\u4e2a\u6570\u5b57\u5b57\u7b26\u7ec4\u6210\u7684\u5b57\u7b26\u4e32\u4e2d\u7684\u5b57\u6bcd\u5b57\u7b26\u3002 \u95ee\u9898\u63cf\u8ff0\u5982\u4e0b\uff1a \u5df2\u77e5\u5b57\u7b26\u4e32\u5177\u6709\u7279\u5b9a\u683c\u5f0f\uff0c\u524d 2 \u81f3 4 \u4e2a\u5b57\u7b26\u4e3a\u5b57\u6bcd\uff0c\u540e\u8ddf\u81f3\u5c11 1 \u4e2a\u6570\u5b57\uff0c\u603b\u957f\u5ea6\u4e0d\u8d85\u8fc7 7 \u4e2a\u5b57\u7b26\u3002\u9700\u8981\u4f7f\u7528 javascript \u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u63d0\u53d6\u8fd9\u4e9b\u5b57\u6bcd\u5b57\u7b26\u3002 \u89e3\u51b3\u65b9\u6848\uff1a \u4ee5\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u4ee5\u7528\u4e8e\u5339\u914d\u6307\u5b9a\u7684\u683c\u5f0f\u5e76\u63d0\u53d6\u5b57\u6bcd\u5b57\u7b26\uff1a \/(^s.*?)d\/ \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\uff1a ^\uff1a\u5339\u914d\u5b57\u7b26\u4e32\u5f00\u5934 s\uff1a\u5339\u914d\u975e\u7a7a\u683c\u5b57\u7b26 .*?\uff1a\u8d2a\u5a6a\u5339\u914d\u540e\u9762\u5c3d\u53ef\u80fd\u77ed\u7684\u5b50\u5e8f\u5217 d\uff1a\u5339\u914d\u6570\u5b57\u5b57\u7b26 \u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5de5\u4f5c\u65b9\u5f0f\u5982\u4e0b\uff1a ^ \u786e\u4fdd\u5339\u914d\u4ece\u5b57\u7b26\u4e32\u5f00\u5934\u5f00\u59cb\u3002 s \u5339\u914d\u975e\u7a7a\u683c\u5b57\u7b26\uff0c\u8fd9\u610f\u5473\u7740\u5b57\u6bcd\u5b57\u7b26\u7684\u4f4d\u7f6e\u3002 .*? \u7136\u540e\u5c3d\u53ef\u80fd\u77ed\u5730\u5339\u914d\u540e\u9762\u7684\u5b57\u6bcd\u5b57\u7b26\u3002 d \u5339\u914d\u968f\u540e\u7684\u6570\u5b57\u5b57\u7b26\uff0c\u6307\u793a\u5b57\u6bcd\u5b57\u7b26\u7ed3\u675f\u7684\u4f4d\u7f6e\u3002 \u4f7f\u7528\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u63d0\u53d6\u5b57\u6bcd\u5b57\u7b26\uff1a const str = &#8220;ASW45687&#8243;; const match = str.match(\/(^S.*?)d\/); const letters = match[1]; \u767b\u5f55\u540e\u590d\u5236 \u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0cletters \u5c06\u5305\u542b\u63d0\u53d6\u7684\u5b57\u6bcd\u5b57\u7b26 &#8220;asw&#8221;\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u524d\u51e0\u4e2a\u5b57\u6bcd\u5b57\u7b26\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\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-3852","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3852","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=3852"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3852\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}