{"id":53535,"date":"2024-12-03T12:50:38","date_gmt":"2024-12-03T04:50:38","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53535\/"},"modified":"2024-12-03T12:50:38","modified_gmt":"2024-12-03T04:50:38","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-javascript-%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e8%8e%b7%e5%8f%96-%e4%b9%8b%e9%97%b4%e7%9a%84%e5%86%85%e5%ae%b9%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53535\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 `< >` \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 `&lt; &gt;` \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f<\/h1>\n<p>\u600e\u4e48\u5165\u95e8\u6587\u7ae0\u7f16\u7a0b\uff1f\u9700\u8981\u5b66\u4e60\u54ea\u4e9b\u77e5\u8bc6\u70b9\uff1f\u8fd9\u662f\u65b0\u624b\u4eec\u521a\u63a5\u89e6\u7f16\u7a0b\u65f6\u5e38\u89c1\u7684\u95ee\u9898\uff1b\u4e0b\u9762\u7c73\u4e91\u5c31\u6765\u7ed9\u5927\u5bb6\u6574\u7406\u5206\u4eab\u4e00\u4e9b\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u591f\u7ed9\u521d\u5b66\u8005\u4e00\u4e9b\u5e2e\u52a9\u3002\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u4ecb\u7ecd\u300a\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 &#8220; \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f\u300b\uff0c\u6d89\u53ca\u5230\uff0c\u6709\u9700\u8981\u7684\u53ef\u4ee5\u6536\u85cf\u4e00\u4e0b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241201\/1733049245674c3b9db64e4.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 `&lt; &gt;` \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 `&lt; &gt;` \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f\u63d2\u56fe\" \/>` \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f&#8221; \/&gt;<\/p>\n<p><strong>\u7528 JavaScript \u6b63\u5219\u83b7\u53d6 &lt;&gt; \u4e4b\u95f4\u7684\u5185\u5bb9<\/strong><\/p>\n<p>\u5728 JavaScript \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u5339\u914d\u548c\u83b7\u53d6\u6307\u5b9a\u5b57\u7b26\u4e32\u3002\u8981\u83b7\u53d6\u4f4d\u4e8e &lt;&gt; \u4e4b\u95f4\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u51c6\u5907\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/strong><\/p>\n<ul>\n<li>\/&lt;(S+)s*\/&#8221;&gt;\/g\u3002\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6253\u5f00\u548c\u5173\u95ed &lt;&gt; \u6807\u7b7e\u4e4b\u95f4\u5305\u542b\u6362\u884c\u7b26 s \u6216\u5176\u4ed6\u5b57\u7b26\u7684\u6587\u672c\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6267\u884c\u5339\u914d\uff1a<\/strong><\/p>\n<ul>\n<li>let matches = string.match(\/&lt;(S+)s*\/&#8221;&gt;\/g)\u3002\u6b64\u64cd\u4f5c\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u5339\u914d\u5b50\u4e32\u7684\u6570\u7ec4\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u63d0\u53d6\u6355\u83b7\u7ec4\uff1a<\/strong><\/p>\n<ul>\n<li>\u5339\u914d\u5b50\u4e32\u4fdd\u5b58\u5728\u7b2c\u4e00\u4e2a\u6355\u83b7\u7ec4\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7 matches[1] \u63d0\u53d6\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u8bf7\u6ce8\u610f\uff0c\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u5339\u914d\u5305\u62ec\u7a7a\u767d\u5b57\u7b26\u5728\u5185\u7684\u6240\u6709\u5185\u5bb9\u3002\u5982\u679c\u4f60\u53ea\u60f3\u5339\u914d\u6587\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u66f4\u4e25\u683c\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\/&lt;(w+)s*\/&#8221;&gt;\/g\uff1a\u5339\u914d\u4ec5\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u7684\u5185\u5bb9<\/li>\n<\/ul>\n<p>\u4f8b\u5982\uff0c\u8003\u8651\u4ee5\u4e0b\u5b57\u7b26\u4e32\uff1a<\/p>\n<p>`&lt;p&gt;\u5509\u7b97\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u6492\u65e6\u6492\u65e6\u8bf4\u9053\u963f\u8428\u5fb7\u8bf4\u9053\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u6492\u65e6\u963f\u8428\u5fb7\u6492\u65e6\u963f\u8428\u5fb7\u6492\u65e6\u963f\u8428\u5fb7\u662f\u963f\u8428\u5fb7&lt;img src=&#8221;http:\/\/p9.pccoo.cn\/webapp\/20161230\/2016123010375539992519_300_300.gif&#8221; \/&gt;<br \/>&lt;img src=&#8221;http:\/\/p9.pccoo.cn\/webapp\/20161230\/2016123010380668807050_300_301.gif&#8221; \/&gt;&lt;\/p&gt;`<\/p>\n<p>\u4f7f\u7528\u4e0a\u9762\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u6211\u4eec\u53ef\u4ee5\u5f97\u5230\u4ee5\u4e0b\u7ed3\u679c\uff1a<\/p>\n<ul>\n<li>matches[1]: &#8220;http:\/\/p9.pccoo.cn\/webapp\/20161230\/2016123010375539992519_300_300.gif&#8221;<\/li>\n<li>matches[2]: &#8220;http:\/\/p9.pccoo.cn\/webapp\/20161230\/2016123010380668807050_300_301.gif&#8221;<\/li>\n<\/ul>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 &#8220; \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u5427\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u4e3a\u4ec0\u4e48\u4f7f\u7528 PyInstaller \u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u65f6\u4f1a\u63d0\u793a\u201cNo module named \\&#8217;PyInstaller\\&#8217;\u201d\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 `&lt; &gt;` \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f \u600e\u4e48\u5165\u95e8\u6587\u7ae0\u7f16\u7a0b\uff1f\u9700\u8981\u5b66\u4e60\u54ea\u4e9b\u77e5\u8bc6\u70b9\uff1f\u8fd9\u662f\u65b0\u624b\u4eec\u521a\u63a5\u89e6\u7f16\u7a0b\u65f6\u5e38\u89c1\u7684\u95ee\u9898\uff1b\u4e0b\u9762\u7c73\u4e91\u5c31\u6765\u7ed9\u5927\u5bb6\u6574\u7406\u5206\u4eab\u4e00\u4e9b\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u591f\u7ed9\u521d\u5b66\u8005\u4e00\u4e9b\u5e2e\u52a9\u3002\u672c\u7bc7\u6587\u7ae0\u5c31\u6765\u4ecb\u7ecd\u300a\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 &#8220; \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f\u300b\uff0c\u6d89\u53ca\u5230\uff0c\u6709\u9700\u8981\u7684\u53ef\u4ee5\u6536\u85cf\u4e00\u4e0b ` \u4e4b\u95f4\u7684\u5185\u5bb9\uff1f&#8221; \/&gt; \u7528 JavaScript \u6b63\u5219\u83b7\u53d6 &lt;&gt; \u4e4b\u95f4\u7684\u5185\u5bb9 \u5728 JavaScript \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u5339\u914d\u548c\u83b7\u53d6\u6307\u5b9a\u5b57\u7b26\u4e32\u3002\u8981\u83b7\u53d6\u4f4d\u4e8e &lt;&gt; \u4e4b\u95f4\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a \u51c6\u5907\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a \/&lt;(S+)s*\/&#8221;&gt;\/g\u3002\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u6253\u5f00\u548c\u5173\u95ed &lt;&gt; \u6807\u7b7e\u4e4b\u95f4\u5305\u542b\u6362\u884c\u7b26 s \u6216\u5176\u4ed6\u5b57\u7b26\u7684\u6587\u672c\u3002 \u6267\u884c\u5339\u914d\uff1a let matches = string.match(\/&lt;(S+)s*\/&#8221;&gt;\/g)\u3002\u6b64\u64cd\u4f5c\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u5339\u914d\u5b50\u4e32\u7684\u6570\u7ec4\u3002 \u63d0\u53d6\u6355\u83b7\u7ec4\uff1a \u5339\u914d\u5b50\u4e32\u4fdd\u5b58\u5728\u7b2c\u4e00\u4e2a\u6355\u83b7\u7ec4\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7 matches[1] \u63d0\u53d6\u3002 \u8bf7\u6ce8\u610f\uff0c\u6b64\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u5339\u914d\u5305\u62ec\u7a7a\u767d\u5b57\u7b26\u5728\u5185\u7684\u6240\u6709\u5185\u5bb9\u3002\u5982\u679c\u4f60\u53ea\u60f3\u5339\u914d\u6587\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u66f4\u4e25\u683c\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u4f8b\u5982\uff1a \/&lt;(w+)s*\/&#8221;&gt;\/g\uff1a\u5339\u914d\u4ec5\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u7684\u5185\u5bb9 \u4f8b\u5982\uff0c\u8003\u8651\u4ee5\u4e0b\u5b57\u7b26\u4e32\uff1a `&lt;p&gt;\u5509\u7b97\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u6492\u65e6\u6492\u65e6\u8bf4\u9053\u963f\u8428\u5fb7\u8bf4\u9053\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u963f\u8428\u5fb7\u6492\u65e6\u963f\u8428\u5fb7\u6492\u65e6\u963f\u8428\u5fb7\u6492\u65e6\u963f\u8428\u5fb7\u662f\u963f\u8428\u5fb7&lt;img src=&#8221;http:\/\/p9.pccoo.cn\/webapp\/20161230\/2016123010375539992519_300_300.gif&#8221; \/&gt;&lt;img src=&#8221;http:\/\/p9.pccoo.cn\/webapp\/20161230\/2016123010380668807050_300_301.gif&#8221; \/&gt;&lt;\/p&gt;` \u4f7f\u7528\u4e0a\u9762\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u6211\u4eec\u53ef\u4ee5\u5f97\u5230\u4ee5\u4e0b\u7ed3\u679c\uff1a matches[1]: &#8220;http:\/\/p9.pccoo.cn\/webapp\/20161230\/2016123010375539992519_300_300.gif&#8221; matches[2]: &#8220;http:\/\/p9.pccoo.cn\/webapp\/20161230\/2016123010380668807050_300_301.gif&#8221; \u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u5982\u4f55\u4f7f\u7528 JavaScript \u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u53d6 [&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-53535","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53535","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=53535"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53535\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}