{"id":464,"date":"2023-02-17T00:46:35","date_gmt":"2023-02-16T16:46:35","guid":{"rendered":"http:\/\/blog.yuekegu.com\/?p=464"},"modified":"2023-02-17T00:46:35","modified_gmt":"2023-02-16T16:46:35","slug":"%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e6%ad%a3%e5%90%91%e5%8c%b9%e9%85%8d%e5%92%8c%e5%8f%8d%e5%90%91%e5%8c%b9%e9%85%8d%e7%9a%84%e5%a6%99%e7%94%a8","status":"publish","type":"post","link":"https:\/\/book.yuekegu.com\/index.php\/2023\/02\/17\/%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e6%ad%a3%e5%90%91%e5%8c%b9%e9%85%8d%e5%92%8c%e5%8f%8d%e5%90%91%e5%8c%b9%e9%85%8d%e7%9a%84%e5%a6%99%e7%94%a8\/","title":{"rendered":"\u6b63\u5219\u8868\u8fbe\u5f0f\u201c\u6b63\u5411\u5339\u914d\u548c\u53cd\u5411\u5339\u914d\u201d\u7684\u5999\u7528"},"content":{"rendered":"\n<p>\u76f8\u4fe1\u5927\u5bb6\u5728\u770b\u6b63\u5219\u8868\u8fbe\u5f0f\u8bed\u6cd5\u7684\u65f6\u5019\u90fd\u4f1a\u9047\u5230\u4e0b\u9762\u51e0\u79cd\uff1a\u6b63\u5411\u80af\u5b9a\uff0c\u6b63\u5411\u5426\u5b9a\uff0c\u53cd\u5411\u80af\u5b9a\uff0c\u53cd\u5411\u5426\u5b9a<\/p>\n\n\n\n<p>1\u3001(?=pattern)<\/p>\n\n\n\n<p>\u6b63\u5411\u80af\u5b9a\u9884\u67e5\uff0c\u5728\u4efb\u4f55\u5339\u914dpattern\u7684\u5b57\u7b26\u4e32\u5f00\u59cb\u5904\u5339\u914d\u67e5\u627e\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<p>\u8fd9\u662f\u4e00\u4e2a\u975e\u83b7\u53d6\u5339\u914d\uff0c\u8be5\u5339\u914d\u4e0d\u9700\u8981\u83b7\u53d6\u4f9b\u4ee5\u540e\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u201cWindows(?=95|98|NT|2000)\u201d\u80fd\u5339\u914d\u201cWindows2000\u201d\u4e2d\u7684\u201cWindows\u201d\uff0c<\/p>\n\n\n\n<p>\u4f46\u4e0d\u80fd\u5339\u914d\u201cWindows3.1\u201d\u4e2d\u7684\u201cWindows\u201d\u3002<\/p>\n\n\n\n<p>\u9884\u67e5\u4e0d\u6d88\u8017\u5b57\u7b26\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5728\u4e00\u4e2a\u5339\u914d\u53d1\u751f\u540e\uff0c\u5728\u6700\u540e\u4e00\u6b21\u5339\u914d\u4e4b\u540e\u7acb\u5373\u5f00\u59cb\u4e0b\u4e00\u6b21\u5339\u914d\u7684\u641c\u7d22\uff0c<\/p>\n\n\n\n<p>\u800c\u4e0d\u662f\u4ece\u5305\u542b\u9884\u67e5\u7684\u5b57\u7b26\u4e4b\u540e\u5f00\u59cb\u3002<\/p>\n\n\n\n<p>2\u3001(?!pattern)<\/p>\n\n\n\n<p>\u6b63\u5411\u5426\u5b9a\u9884\u67e5\uff0c\u5728\u4efb\u4f55\u4e0d\u5339\u914dpattern\u7684\u5b57\u7b26\u4e32\u5f00\u59cb\u5904\u5339\u914d\u67e5\u627e\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<p>\u8fd9\u662f\u4e00\u4e2a\u975e\u83b7\u53d6\u5339\u914d\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u8be5\u5339\u914d\u4e0d\u9700\u8981\u83b7\u53d6\u4f9b\u4ee5\u540e\u4f7f\u7528\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\u201cWindows(?!95|98|NT|2000)\u201d\u80fd\u5339\u914d\u201cWindows3.1\u201d\u4e2d\u7684\u201cWindows\u201d\uff0c<\/p>\n\n\n\n<p>\u4f46\u4e0d\u80fd\u5339\u914d\u201cWindows2000\u201d\u4e2d\u7684\u201cWindows\u201d\u3002<\/p>\n\n\n\n<p>3\u3001(?&lt;=pattern)<\/p>\n\n\n\n<p>\u53cd\u5411\u80af\u5b9a\u9884\u67e5\uff0c\u4e0e\u6b63\u5411\u80af\u5b9a\u9884\u67e5\u7c7b\u4f3c\uff0c\u53ea\u662f\u65b9\u5411\u76f8\u53cd\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u201c(?&lt;=95|98|NT|2000)Windows\u201d\u80fd\u5339\u914d\u201c2000Windows\u201d\u4e2d\u7684\u201cWindows\u201d\uff0c<\/p>\n\n\n\n<p>\u4f46\u4e0d\u80fd\u5339\u914d\u201c3.1Windows\u201d\u4e2d\u7684\u201cWindows\u201d\u3002<\/p>\n\n\n\n<p>4\u3001(?&lt;!pattern)<\/p>\n\n\n\n<p>\u53cd\u5411\u5426\u5b9a\u9884\u67e5\uff0c\u4e0e\u6b63\u5411\u5426\u5b9a\u9884\u67e5\u7c7b\u4f3c\uff0c\u53ea\u662f\u65b9\u5411\u76f8\u53cd\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\u201c(?&lt;!95|98|NT|2000)Windows\u201d\u80fd\u5339\u914d\u201c3.1Windows\u201d\u4e2d\u7684\u201cWindows\u201d\uff0c<\/p>\n\n\n\n<p>\u4f46\u4e0d\u80fd\u5339\u914d\u201c2000Windows\u201d\u4e2d\u7684\u201cWindows\u201d\u3002<\/p>\n\n\n\n<p>\u6211\u7b2c\u4e00\u6b21\u770b\u7684\u65f6\u5019\u5c31\u89c9\u5f97\u5f88\u96be\u7406\u89e3\uff0c\u8bfb\u4e86\u4e24\u904d\u597d\u4e0d\u5bb9\u6613\u7406\u89e3\u4e86\uff0c\u4f46\u662f\u4e00\u76f4\u7528\u4e0d\u4e0a\uff0c\u76f4\u5230\u5de5\u4f5c\u9700\u8981\u2026\u2026\u2026\u2026\u2026<\/p>\n\n\n\n<p>str = &#8220;111\/;hkakdhaldladhl;gddhkshls;hhhh&#8221;<br>\n\u7528 ; \u5207\u5272\u5b57\u7b26\u4e32\uff0c\u8981\u6c42\u5207\u5272\u7ed3\u679c\u662f111\/;hkakdhaldladhl        gddhkshls        hhhh\uff0c\u4e5f\u5c31\u662f\u7b2c\u4e00\u4e2a;\u524d\u9762\u6709\/\uff0c\u6240\u4ee5\u7b2c\u4e00\u4e2a;\u4e0d\u5206\u5272\uff0c\u53ea\u5206\u5272\u540e\u9762\u7684;<\/p>\n\n\n\n<p>\u8fd9\u5176\u5b9e\u5c31\u7528\u5230\u4e86\u53cd\u5411\u5426\u5b9a\uff0c\u5c06python\u91cc\u9762\u7684split\u51fd\u6570\u548c\u6b63\u5219\u8868\u8fbe\u5f0f\u5b8c\u7f8e\u7ed3\u5408\u5728\u4e00\u8d77\uff0c\u5927\u5bb6\u6839\u636e\u6211\u7684\u4f8b\u5b50\u518d\u53bb\u7406\u89e3\u6b63(\u53cd)\u5411\u5426(\u80af)\u5b9a\u5339\u914d\uff0c\u80af\u5b9a\u5c31\u66f4\u6e05\u6670\u4e86<br>\npython\u4ee3\u7801\u5b9e\u73b0\uff1a<\/p>\n\n\n\n<p>import re<\/p>\n\n\n\n<p>str = &#8220;111\/;hkakdhaldladhl;gddhkshls;hhhh&#8221;<br>\nstr_list = re.split(r&#8221;(?&lt;!\\\/);&#8221;,str)<br>\nprint(str_list)<br>\n\u7ed3\u679c\uff1a<\/p>\n\n\n\n<p>\u6ce8\uff1a?&lt;! \u662f\u53cd\u5411\u5426\u5b9a\u7684\u610f\u601d\uff0c \\\/  \u662f\u5bf9  \/  \u505a\u4e86\u8f6c\u4e49<\/p>\n\n\n\n<p>\u4e3a\u4e86\u80fd\u8bb0\u5f97\u4f4f\uff0c\u6211\u603b\u7ed3\u4e86\u4e0b\u9762\u7684\u89c4\u5f8b\uff0c\u4f9b\u53c2\u8003~~<\/p>\n\n\n\n<p>&#8220;\u80af\u5b9a&#8221; \u5c31\u662f\u51fa\u73b0\u5728?&lt;!    ?&lt;=    ?!   ?= \u540e\u9762\u90a3\u4e9b\u5b57\u7b26\uff0c\u6211\u4eec\u8981\u5339\u914d\u7684\u5b57\u7b26\u4e32\u5e26\u8fd9\u4e2a\u624d\u53bb\u5339\u914d<\/p>\n\n\n\n<p>&#8220;\u5426\u5b9a&#8221;\u5c31\u662f\u51fa\u73b0\u5728?&lt;!    ?&lt;=    ?!   ?= \u540e\u9762\u90a3\u4e9b\u5b57\u7b26\uff0c\u6211\u4eec\u8981\u5339\u914d\u7684\u5b57\u7b26\u4e32\u4e0d\u5e26\u8fd9\u4e2a\u624d\u53bb\u5339\u914d<\/p>\n\n\n\n<p>&#8220;\u6b63\u53cd\u5411&#8221;\u5c31\u662f\u4f8b\u5b50\u91cc\u9762windows\u5728 ?&lt;!    ?&lt;=    ?!   ?= \u4ee5\u53ca\u540e\u9762\u5b57\u7b26\u7684\u524d\u9762\u8fd8\u662f\u540e\u9762\uff0cwindows\u5728\u540e\u662f\u53cd\u5411\uff0c\u5728\u524d\u662f\u6b63\u5411<\/p>\n\n\n\n<p>\u8bb0\u8d77\u6765\u5c31\u662f\uff0c\u56db\u79cd\u90fd\u8981\u5e26\uff1f \u80af\u5b9a\u7684\u662f=   \u5426\u5b9a\u7684\u662f!     \u5982\u679c\u662f\u53cd\u5411\u5c31\u52a0\u4e0a&lt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76f8\u4fe1\u5927\u5bb6\u5728\u770b\u6b63\u5219\u8868\u8fbe\u5f0f\u8bed\u6cd5\u7684\u65f6\u5019\u90fd\u4f1a\u9047\u5230\u4e0b\u9762\u51e0\u79cd\uff1a\u6b63\u5411\u80af\u5b9a\uff0c\u6b63\u5411\u5426\u5b9a\uff0c\u53cd\u5411\u80af\u5b9a\uff0c\u53cd\u5411\u5426\u5b9a 1\u3001(?=pattern) \u6b63\u5411\u80af\u5b9a\u9884\u67e5\uff0c\u5728\u4efb\u4f55\u5339\u914dpattern\u7684\u5b57\u7b26\u4e32\u5f00\u59cb\u5904\u5339\u914d\u67e5\u627e\u5b57\u7b26\u4e32\u3002 \u8fd9\u662f\u4e00\u4e2a\u975e\u83b7\u53d6\u5339\u914d\uff0c\u8be5\u5339\u914d\u4e0d\u9700\u8981\u83b7\u53d6\u4f9b\u4ee5\u540e\u4f7f\u7528\u3002 \u4f8b\u5982\uff0c\u201cWindows(?=95|98|NT|2000)\u201d\u80fd\u5339\u914d\u201cWindows2000\u201d\u4e2d\u7684\u201cWindows\u201d\uff0c \u4f46\u4e0d\u80fd\u5339\u914d\u201cWindows3.1\u201d\u4e2d\u7684\u201cWindows\u201d\u3002 \u9884\u67e5\u4e0d\u6d88\u8017\u5b57\u7b26\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5728\u4e00\u4e2a\u5339\u914d\u53d1\u751f\u540e\uff0c\u5728\u6700\u540e\u4e00\u6b21\u5339\u914d\u4e4b\u540e\u7acb\u5373\u5f00\u59cb\u4e0b\u4e00\u6b21\u5339\u914d\u7684\u641c\u7d22\uff0c \u800c\u4e0d\u662f\u4ece\u5305\u542b\u9884\u67e5\u7684\u5b57\u7b26\u4e4b\u540e\u5f00\u59cb\u3002 2\u3001(?!pattern) \u6b63\u5411\u5426\u5b9a\u9884\u67e5\uff0c\u5728\u4efb\u4f55\u4e0d\u5339\u914dpattern\u7684\u5b57\u7b26\u4e32\u5f00\u59cb\u5904\u5339\u914d\u67e5\u627e\u5b57\u7b26\u4e32\u3002 \u8fd9\u662f\u4e00\u4e2a\u975e\u83b7\u53d6\u5339\u914d\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u8be5\u5339\u914d\u4e0d\u9700\u8981\u83b7\u53d6\u4f9b\u4ee5\u540e\u4f7f\u7528\u3002 \u4f8b\u5982\u201cWindows(?!95|98|NT|2000)\u201d\u80fd\u5339\u914d\u201cWindows3.1\u201d\u4e2d\u7684\u201cWindows\u201d\uff0c \u4f46\u4e0d\u80fd\u5339\u914d\u201cWindows2000\u201d\u4e2d\u7684\u201cWindows\u201d\u3002 3\u3001(?&lt;=pattern) \u53cd\u5411\u80af\u5b9a\u9884\u67e5\uff0c\u4e0e\u6b63\u5411\u80af\u5b9a\u9884\u67e5\u7c7b\u4f3c\uff0c\u53ea\u662f\u65b9\u5411\u76f8\u53cd\u3002 \u4f8b\u5982\uff0c\u201c(?&lt;=95|98|NT|2000)Windows\u201d\u80fd\u5339\u914d\u201c2000Windows\u201d\u4e2d\u7684\u201cWindows\u201d\uff0c \u4f46\u4e0d\u80fd\u5339\u914d\u201c3.1Windows\u201d\u4e2d\u7684\u201cWindows\u201d\u3002 4\u3001(?&lt;!pattern) \u53cd\u5411\u5426\u5b9a\u9884\u67e5\uff0c\u4e0e\u6b63\u5411\u5426\u5b9a\u9884\u67e5\u7c7b\u4f3c\uff0c\u53ea\u662f\u65b9\u5411\u76f8\u53cd\u3002 \u4f8b\u5982\u201c(?&lt;!95|98|NT|2000)Windows\u201d\u80fd\u5339\u914d\u201c3.1Windows\u201d\u4e2d\u7684\u201cWindows\u201d\uff0c \u4f46\u4e0d\u80fd\u5339\u914d\u201c2000Windows\u201d\u4e2d\u7684\u201cWindows\u201d\u3002 \u6211\u7b2c\u4e00\u6b21\u770b\u7684\u65f6\u5019\u5c31\u89c9\u5f97\u5f88\u96be\u7406\u89e3\uff0c\u8bfb\u4e86\u4e24\u904d\u597d\u4e0d\u5bb9\u6613\u7406\u89e3\u4e86\uff0c\u4f46\u662f\u4e00\u76f4\u7528\u4e0d\u4e0a\uff0c\u76f4\u5230\u5de5\u4f5c\u9700\u8981\u2026\u2026\u2026\u2026\u2026 str = &#8220;111\/;hkakdhaldladhl;gddhkshls;hhhh&#8221; \u7528 ; \u5207\u5272\u5b57\u7b26\u4e32\uff0c\u8981\u6c42\u5207\u5272\u7ed3\u679c\u662f111\/;hkakdhaldladhl gddhkshls hhhh\uff0c\u4e5f\u5c31\u662f\u7b2c\u4e00\u4e2a;\u524d\u9762\u6709\/\uff0c\u6240\u4ee5\u7b2c\u4e00\u4e2a;\u4e0d\u5206\u5272\uff0c\u53ea\u5206\u5272\u540e\u9762\u7684; \u8fd9\u5176\u5b9e\u5c31\u7528\u5230\u4e86\u53cd\u5411\u5426\u5b9a\uff0c\u5c06python\u91cc\u9762\u7684split\u51fd\u6570\u548c\u6b63\u5219\u8868\u8fbe\u5f0f\u5b8c\u7f8e\u7ed3\u5408\u5728\u4e00\u8d77\uff0c\u5927\u5bb6\u6839\u636e\u6211\u7684\u4f8b\u5b50\u518d\u53bb\u7406\u89e3\u6b63(\u53cd)\u5411\u5426(\u80af)\u5b9a\u5339\u914d\uff0c\u80af\u5b9a\u5c31\u66f4\u6e05\u6670\u4e86 python\u4ee3\u7801\u5b9e\u73b0\uff1a import re str = &#8220;111\/;hkakdhaldladhl;gddhkshls;hhhh&#8221; str_list = re.split(r&#8221;(?&lt;!\\\/);&#8221;,str) print(str_list) \u7ed3\u679c\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-464","post","type-post","status-publish","format-standard","hentry","category-27"],"_links":{"self":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts\/464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/comments?post=464"}],"version-history":[{"count":0,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/posts\/464\/revisions"}],"wp:attachment":[{"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/media?parent=464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/categories?post=464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/book.yuekegu.com\/index.php\/wp-json\/wp\/v2\/tags?post=464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}