{"id":2354,"date":"2024-11-10T11:37:41","date_gmt":"2024-11-10T03:37:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/2354\/"},"modified":"2024-11-10T11:37:41","modified_gmt":"2024-11-10T03:37:41","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%e9%aa%8c%e8%af%81url%e6%98%af%e5%90%a6%e4%bb%a5%e7%89%b9%e5%ae%9a%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%bc%80%e5%a4%b4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/2354\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1URL\u662f\u5426\u4ee5\u7279\u5b9a\u5b57\u7b26\u4e32\u5f00\u5934\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173071981811435.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1URL\u662f\u5426\u4ee5\u7279\u5b9a\u5b57\u7b26\u4e32\u5f00\u5934\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1URL\u662f\u5426\u4ee5\u7279\u5b9a\u5b57\u7b26\u4e32\u5f00\u5934\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u4ee5\u7279\u5b9a url \u5f00\u5934\u7684\u5730\u5740<\/strong><\/p>\n<p>\u60f3\u8981\u9a8c\u8bc1 url \u662f\u5426\u4ee5\u7279\u5b9a\u7684\u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u3002\u5728 javascript \u4e2d\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u7ec4\u5b57\u7b26\uff0c\u7528\u4e8e\u5339\u914d\u5b57\u7b26\u4e32\u6216\u5b50\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u6a21\u5f0f\u3002<\/p>\n<p>\u5bf9\u4e8e\u4f60\u6240\u8bf4\u7684\u95ee\u9898\uff0c\u4f60\u9700\u8981\u9a8c\u8bc1 url \u662f\u5426\u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\u3002\u4e3a\u6b64\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/p>\n<pre>\/^https:\/\/itunes.apple.com\/<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u4ece\u5b57\u7b26\u4e32\u7684\u5f00\u5934\u5f00\u59cb (^)\uff0c\u7136\u540e\u5339\u914d https:\/\/itunes.apple.com \u5b57\u7b26\u4e32\u3002\u5982\u679c url \u4ee5\u6b64\u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u8fd4\u56de true\uff0c\u5426\u5219\u8fd4\u56de false\u3002<\/p>\n<p><strong>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528 match() \u65b9\u6cd5\u6765\u6d4b\u8bd5\u4e00\u4e2a\u5b57\u7b26\u4e32\u662f\u5426\u4e0e\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>const url = \"https:\/\/itunes.apple.com\/us\/app\/apple-store\/id364902227?mt=8\";\nconst pattern = \/^https:\/\/itunes.apple.com\/;\nconst result = url.match(pattern);\n\nif (result) {\n  console.log(\"URL \u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\u3002\");\n} else {\n  console.log(\"URL \u4e0d\u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\u3002\");\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5982\u679c url \u53d8\u91cf\u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\uff0c\u5219 result \u53d8\u91cf\u5c06\u5305\u542b\u4e0e\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u7684\u5b57\u7b26\u4e32\uff0c\u5e76\u4e14\u4ee3\u7801\u5c06\u6253\u5370 &#8220;url \u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\u3002&#8221; \u6d88\u606f\u3002\u5426\u5219\uff0c\u4ee3\u7801\u5c06\u6253\u5370 &#8220;url \u4e0d\u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\u3002&#8221; \u6d88\u606f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1URL\u662f\u5426\u4ee5\u7279\u5b9a\u5b57\u7b26\u4e32\u5f00\u5934\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>\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u4ee5\u7279\u5b9a url \u5f00\u5934\u7684\u5730\u5740 \u60f3\u8981\u9a8c\u8bc1 url \u662f\u5426\u4ee5\u7279\u5b9a\u7684\u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u3002\u5728 javascript \u4e2d\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u7ec4\u5b57\u7b26\uff0c\u7528\u4e8e\u5339\u914d\u5b57\u7b26\u4e32\u6216\u5b50\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u5b9a\u6a21\u5f0f\u3002 \u5bf9\u4e8e\u4f60\u6240\u8bf4\u7684\u95ee\u9898\uff0c\u4f60\u9700\u8981\u9a8c\u8bc1 url \u662f\u5426\u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\u3002\u4e3a\u6b64\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a \/^https:\/\/itunes.apple.com\/ \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u4ece\u5b57\u7b26\u4e32\u7684\u5f00\u5934\u5f00\u59cb (^)\uff0c\u7136\u540e\u5339\u914d https:\/\/itunes.apple.com \u5b57\u7b26\u4e32\u3002\u5982\u679c url \u4ee5\u6b64\u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u8fd4\u56de true\uff0c\u5426\u5219\u8fd4\u56de false\u3002 \u4f7f\u7528\u65b9\u6cd5\uff1a \u4f60\u53ef\u4ee5\u4f7f\u7528 match() \u65b9\u6cd5\u6765\u6d4b\u8bd5\u4e00\u4e2a\u5b57\u7b26\u4e32\u662f\u5426\u4e0e\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u3002\u4f8b\u5982\uff1a const url = &#8220;https:\/\/itunes.apple.com\/us\/app\/apple-store\/id364902227?mt=8&#8221;; const pattern = \/^https:\/\/itunes.apple.com\/; const result = url.match(pattern); if (result) { console.log(&#8220;URL \u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\u3002&#8221;); } else { console.log(&#8220;URL \u4e0d\u4ee5 https:\/\/itunes.apple.com \u5f00\u5934\u3002&#8221;); } \u767b\u5f55\u540e\u590d\u5236 [&hellip;]<\/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-2354","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2354","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=2354"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2354\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=2354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=2354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=2354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}