{"id":5508,"date":"2023-09-12T20:02:00","date_gmt":"2023-09-12T12:02:00","guid":{"rendered":"https:\/\/ixyzero.com\/blog\/?p=5508"},"modified":"2023-09-12T16:47:40","modified_gmt":"2023-09-12T08:47:40","slug":"%e8%bf%91%e6%9c%9f%e7%9a%84%e4%b8%80%e4%ba%9b%e9%9b%b6%e7%a2%8e%e7%9f%a5%e8%af%86%e7%82%b9%e6%95%b4%e7%90%86","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/5508.html","title":{"rendered":"\u8fd1\u671f\u7684\u4e00\u4e9b\u96f6\u788e\u77e5\u8bc6\u70b9\u6574\u7406"},"content":{"rendered":"\n<p>=Start=<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u7f18\u7531\uff1a<\/h4>\n\n\n\n<p>\u7b80\u5355\u6574\u7406\u8bb0\u5f55\u4e00\u4e0b\u8fd1\u671f\u60f3\u5230\u7684\u4e00\u4e9b\u77e5\u8bc6\u70b9\uff0c\u7ed3\u6784\u6bd4\u8f83\u96f6\u6563\uff0c\u4f46\u662f\u5185\u5bb9\u89c9\u5f97\u8fd8\u6bd4\u8f83\u91cd\u8981\uff0c\u6240\u4ee5\u4e13\u95e8\u5f00\u4e00\u7bc7\u6587\u7ae0\u8bb0\u5f55\u4e00\u4e0b\uff0c\u65b9\u4fbf\u540e\u9762\u6709\u9700\u8981\u7684\u65f6\u5019\u53c2\u8003\u548c\u7ee7\u7eed\u8865\u5145\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u6b63\u6587\uff1a<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n\n\n\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u201c\u975e\u6355\u83b7\u201d\u548c\u201c\u6b63\u8d1f\u5411\u73af\u89c6\/\u9884\u67e5\u201d<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u7528Hive SQL\u8fdb\u884c\u6b63\u5219\u5339\u914d\u548c\u63d0\u53d6<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>regexp_extract(reflect(\"java.net.URLDecoder\", \"decode\",query_string,\"UTF-8\"), 'keywords=(&#91;^&amp;]+)&amp;?', 0) as keywords, --\u8fbe\u5230\u9884\u671f\nregexp_extract(query_string, 'keywords=(&#91;^&amp;]+)&amp;?', 0) as keywords_raw, --\u8fbe\u5230\u9884\u671f\nregexp_extract(query_string, 'keywords=(.+)&amp;?', 0) as keywords_raw2, --\u4e0d\u8fbe\u9884\u671f\nregexp_extract(query_string, 'keywords=(.{1,})&amp;?', 0) as keywords_raw3, --\u4e0d\u8fbe\u9884\u671f\n\n-- \u7ed3\u679c\u62bd\u6837\nkeywords=IT&amp;    keywords=IT&amp;    keywords=IT&amp;pageNum=1&amp;pageSize=30   keywords=IT&amp;pageNum=1&amp;pageSize=30   keywords=IT&amp;pageNum=1&amp;pageSize=30\n        keywords=&amp;pageNum=1&amp;pageSize=30 keywords=&amp;pageNum=1&amp;pageSize=30 keywords=&amp;pageNum=1&amp;pageSize=30\nkeywords=\u5b89\u5168&amp;    keywords=%E5%AE%89%E5%85%A8&amp;    keywords=%E5%AE%89%E5%85%A8&amp;pageNum=1&amp;pageSize=30   keywords=%E5%AE%89%E5%85%A8&amp;pageNum=1&amp;pageSize=30   keywords=%E5%AE%89%E5%85%A8&amp;pageNum=1&amp;pageSize=30<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\u7b80\u5355\u6574\u7406\uff1a\n1. \u5bf9\u4e8e\u8bf7\u6c42\u53c2\u6570\u5185\u5bb9\u7684\u63d0\u53d6\uff08\u6709\u8f83\u4e3a\u56fa\u5b9a\u7684\u5206\u9694\u7b26\uff0c\u6bd4\u5982&amp;\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528\u975e\u7279\u5b9a\u5b57\u7b26(&#91;^&amp;])\u7684\u65b9\u5f0f\u6765\u66ff\u4ee3\u70b9(.)\n2. \u8fd8\u6709\u5c31\u662f\u5728\u4e0a\u9762\u64cd\u4f5c\u7684\u57fa\u7840\u4e0a\uff0c\u4e0d\u8981\u518d(.+?)\u6216\u662f(.*?)\u8fd9\u79cd\u975e\u8d2a\u5a6a\u7684\u65b9\u5f0f\u4e86\uff0c\u4f1a\u5bfc\u81f4\u62ff\u5230\u7684\u7ed3\u679c\u4e0d\u5168\n3. \u6700\u597d\u5c31\u662f( keywords=(&#91;^&amp;]+)&amp;? )\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4e0d\u5bb9\u6613\u8bef\u5339\u914d\uff0c\u4e5f\u4e0d\u5bb9\u6613\u6f0f\u6389\u6709\u6548\u4fe1\u606f<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">HIVE SQL\u4e2d\u7684\u975e\u7a7a\u67e5\u627e\u51fd\u6570<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\u975e\u7a7a\u67e5\u627e\u51fd\u6570 : COALESCE\n\u8bed\u6cd5: COALESCE(T v1, T v2, \u2026)\n\u8fd4\u56de\u503c: T\n\u8bf4\u660e:  \u8fd4\u56de\u53c2\u6570\u4e2d\u7684\u7b2c\u4e00\u4e2a\u975e\u7a7a\u503c\uff1b\u5982\u679c\u6240\u6709\u503c\u90fd\u4e3aNULL\uff0c\u90a3\u4e48\u8fd4\u56deNULL\n\nhive&gt; select COALESCE(null,'100','50');\n100<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u6b63\u5219\u8868\u8fbe\u5f0f-\u975e\u6355\u83b7\u5339\u914d<\/h5>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5b57\u7b26<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>(?:pattern)<\/td><td><strong>\u5339\u914dpattern\u4f46\u4e0d\u83b7\u53d6\u5339\u914d\u7ed3\u679c\uff0c\u4e5f\u5c31\u662f\u8bf4\u8fd9\u662f\u4e00\u4e2a\u975e\u83b7\u53d6\u5339\u914d\uff0c\u4e0d\u8fdb\u884c\u5b58\u50a8\u4f9b\u4ee5\u540e\u4f7f\u7528\u3002<\/strong>\u8fd9\u5728\u4f7f\u7528\u6216\u5b57\u7b26\u201c(|)\u201d\u6765\u7ec4\u5408\u4e00\u4e2a\u6a21\u5f0f\u7684\u5404\u4e2a\u90e8\u5206\u662f\u5f88\u6709\u7528\u3002\u4f8b\u5982\u201cindustr(?:y|ies)\u201d\u5c31\u662f\u4e00\u4e2a\u6bd4\u201cindustry|industries\u201d\u66f4\u7b80\u7565\u7684\u8868\u8fbe\u5f0f\u3002<\/td><\/tr><tr><td>(pattern)<\/td><td>\u5339\u914dpattern\u5e76\u83b7\u53d6\u8fd9\u4e00\u5339\u914d\u3002\u6240\u83b7\u53d6\u7684\u5339\u914d\u53ef\u4ee5\u4ece\u4ea7\u751f\u7684Matches\u96c6\u5408\u5f97\u5230\uff0c\u5728VBScript\u4e2d\u4f7f\u7528SubMatches\u96c6\u5408\uff0c\u5728JScript\u4e2d\u5219\u4f7f\u7528$0\u2026$9\u5c5e\u6027\u3002\u8981\u5339\u914d\u5706\u62ec\u53f7\u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528\u201c(\u201d\u6216\u201c)\u201d\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u4e0d\u8981\u8ba9\u7a3b\u8349\u538b\u6b7b\u9a86\u9a7c\u3002\u6bcf\u4f7f\u7528\u4e00\u4e2a\u666e\u901a\u62ec\u53f7()\u800c\u4e0d\u662f\u975e\u6355\u83b7\u578b\u62ec\u53f7(?:\u2026)\uff0c\u5c31\u4f1a\u4fdd\u7559\u4e00\u90e8\u5206\u5185\u5b58\u7b49\u7740\u4f60\u518d\u6b21\u8bbf\u95ee\u3002\u8fd9\u6837\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u3001\u65e0\u9650\u6b21\u5730\u8fd0\u884c\u6b21\u6570\uff0c\u65e0\u5f02\u4e8e\u4e00\u6839\u6839\u7a3b\u8349\u7684\u5806\u52a0\uff0c\u7ec8\u4e8e\u80fd\u5c06\u9a86\u9a7c\u538b\u6b7b\u3002<strong>\u517b\u6210\u5408\u7406\u4f7f\u7528(?:\u2026)\u975e\u6355\u83b7\u5339\u914d\u7684\u4e60\u60ef<\/strong>\u3002<\/p>\n\n\n\n<p>\u9ed8\u8ba4\u7684\u591a\u9009\u5206\u652f\u300e(\u2026|\u2026)\u300f\u4f7f\u7528\u7684\u62ec\u53f7\u662f\u4f1a\u6355\u83b7\u6587\u672c\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u62ec\u53f7\u5185\u7684\u8868\u8fbe\u5f0f\u771f\u6b63\u5339\u914d\u6210\u529f\u7684\u6587\u672c\u4f1a\u8bb0\u5f55\u4e0b\u6765\uff0c\u5339\u914d\u5b8c\u6210\u4e4b\u540e\u53ef\u4ee5\u63d0\u53d6\u51fa\u6765\u3002\u4f46\u8bb8\u591a\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u7684\u53ea\u662f\u6574\u4e2a\u8868\u8fbe\u5f0f\u7684\u5339\u914d\uff0c\u800c\u4e0d\u5173\u5fc3\u201c\u5339\u914d\u65f6\u5230\u5e95\u9009\u62e9\u7684\u54ea\u79cd\u53ef\u80fd\u60c5\u51b5\u201d\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u7a0d\u52a0\u4fee\u6539\uff0c\u4f7f\u7528\u201c\u4e0d\u6355\u83b7\u6587\u672c\u7684\u62ec\u53f7\u201d\uff0c\u53ef\u4ee5\u63d0\u9ad8\u6548\u7387\u3002\u4e0d\u6355\u83b7\u6587\u672c\u7684\u5199\u6cd5\u4e5f\u5f88\u7b80\u5355\uff0c\u53ea\u662f\u5728\u5f00\u6269\u53f7\u4e4b\u540e\u52a0\u4e0a\u5b57\u7b26\u300e?:\u300f\uff0c\u4e5f\u5c31\u662f\u300e(?:\u2026|\u2026)\u300f\u3002\u8fd9\u6837\u505a\u867d\u7136\u7e41\u7410\u70b9\uff0c\u4f46\u6548\u7387\u6709\u4fdd\u969c\uff0c\u9605\u8bfb\u8d77\u6765\u4e5f\u4e0d\u56f0\u96be\uff0c<strong>\u6211\u63a8\u8350\u517b\u6210\u8fd9\u79cd\u4e60\u60ef\uff0c<\/strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fb0000\" class=\"has-inline-color\"><strong>\u53ea\u8981\u7528\u5230\u4e86\u62ec\u53f7\uff0c\u5c31\u60f3\u60f3\u662f\u5426\u771f\u7684\u8981\u6355\u83b7\u62ec\u53f7\u5185\u8868\u8fbe\u5f0f\u5339\u914d\u7684\u6587\u672c\uff0c\u5982\u679c\u4e0d\u9700\u8981\uff0c\u5c31\u662f\u7528\u4e0d\u6355\u83b7\u6587\u672c\u7684\u62ec\u53f7<\/strong>\u3002<\/mark><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\u6b63\u5219\u8868\u8fbe\u5f0f-\u73af\u89c6\/\u9884\u67e5<\/h5>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5b57\u7b26<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>(?=pattern)<\/td><td>\u6b63\u5411\u9884\u67e5\uff0c\u5728\u4efb\u4f55<strong>\u5339\u914d<\/strong>pattern\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\uff0c\u201cWindows(?=95<\/td><\/tr><tr><td>(?!pattern)<\/td><td>\u8d1f\u5411\u9884\u67e5\uff0c\u5728\u4efb\u4f55<strong>\u4e0d\u5339\u914d<\/strong>pattern\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<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u73af\u89c6\u662f\u4ec0\u4e48\u2014\u2014\u73af\u89c6\u987e\u540d\u601d\u4e49\u5c31\u662f\u300c\u73af\u987e\u56db\u5468\uff0c\u5411\u5de6\u770b\u770b\u5411\u770b\u770b\uff0c\u627e\u4e00\u4e2a\u5408\u9002\u7684\u4f4d\u7f6e\u300d\u3002<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fa0000\" class=\"has-inline-color\">\u73af\u89c6\u300c\u5339\u914d\u7684\u662f\u4e00\u4e2a\u4f4d\u7f6e\u800c\u4e0d\u662f\u5b57\u7b26\uff0c\u8fd9\u70b9\u5c24\u4e3a\u91cd\u8981\u300d\u3002<\/mark><\/strong><\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fe0000\" class=\"has-inline-color\">\u9996\u5148\u89e3\u91ca\u4e00\u4e0b\u4ec0\u4e48\u662f\u300c\u987a\u5e8f\u73af\u89c6\u300d\uff0c\u4ec0\u4e48\u662f\u300c\u9006\u5e8f\u73af\u89c6\u300d\u3002<strong>\u56e0\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\u8fc7\u7a0b\u662f\u4ece\u5de6\u5230\u53f3\u7684\uff0c\u6240\u4ee5\u5982\u679c\u6211\u4eec\u8981\u300c\u5224\u65ad\u4e00\u4e2a\u4f4d\u7f6e\u7684\u53f3\u8fb9\u6ee1\u4e0d\u6ee1\u8db3\u67d0\u4e2a\u6761\u4ef6\uff0c\u8fd9\u5c31\u53eb\u987a\u5e8f\u73af\u89c6\u300d\u3002\u5982\u679c\u6211\u4eec\u300c\u5224\u65ad\u4e00\u4e2a\u4f4d\u7f6e\u7684\u5de6\u8fb9\u6ee1\u4e0d\u6ee1\u8db3\u67d0\u79cd\u6761\u4ef6\u7684\u8bdd\uff0c\u8fd9\u5c31\u53eb\u505a\u9006\u5e8f\u73af\u89c6\u3002\u300d<\/strong><\/mark><\/p>\n\n\n\n<p>\u4f60\u53ef\u80fd\u4f1a\u89c9\u5f97\u4e0a\u9762\u8fd9\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u6709\u70b9\u96be\u8bb0\uff0c\u9996\u5148\u6211\u4eec\u9700\u8981\u77e5\u9053\u300c\u73af\u89c6\u90fd\u662f\u4ee5(?\u4f5c\u4e3a\u5f00\u5934\u7684\uff0c\u7136\u540e\u63a5\u4e0b\u6765\u7684\u4e00\u5230\u4e24\u4e2a\u7b26\u53f7\u8868\u660e\u662f\u90a3\u79cd\u73af\u89c6\uff0c\u518d\u7136\u540e\u5c31\u662f\u9700\u8981\u6ee1\u8db3\u7684\u6761\u4ef6\uff0c\u6700\u540e\u662f\u4e00\u4e2a)\u8868\u793a\u7ed3\u675f\u3002(?=\u6761\u4ef6)\u53ef\u4ee5\u8fd9\u6837\u7406\u89e3\uff0c?\u8868\u793a\u7591\u95ee\uff0c=\u8868\u793a\u662f\u5426\u6ee1\u8db3\u5339\u914d\u3002\u4e5f\u5c31\u662f\u5f53\u524d\u4f4d\u7f6e\u662f\u5426\u6ee1\u8db3\u7ed9\u51fa\u7684\u6761\u4ef6\u3002\u300d<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u80af\u5b9a\u7684\u987a\u5e8f\u73af\u89c6 -&gt; (?=\u674e\u56db)<\/li>\n<\/ol>\n\n\n\n<p>\u5047\u5982\u4f60\u73b0\u5728\u662f\u4e00\u540d\u53eb\u5f20\u4e09\u7684\u5b66\u751f\uff0c\u73b0\u5728\u662f\u4f53\u80b2\u8bfe\u9700\u8981\u5927\u5bb6\u6392\u4e2a\u961f\uff0c<strong>\u4f60\u8bb0\u6027\u4e0d\u597d\u5fd8\u8bb0\u4e86\u81ea\u5df1\u4e4b\u524d\u7684\u4f4d\u7f6e\uff0c\u4f46\u662f\u4f60\u8fd8\u8bb0\u5f97\u4f60\u7684\u540e\u9762\u662f\u674e\u56db\u3002<\/strong>\u6240\u4ee5\u8fd9\u4e2a\u65f6\u5019\u4f60\u80af\u5b9a\u300c\u5148\u627e\u5230\u674e\u56db\uff0c\u7136\u540e\u7ad9\u5728\u4ed6\u7684\u524d\u9762\u5c31\u53ef\u4ee5\u4e86\u300d\u3002\u6240\u4ee5\u4f60\u8fd9\u4e2a\u9009\u62e9\u80cc\u540e\u7684\u903b\u8f91\u662f\uff0c\u300c\u6211\u7ad9\u7684\u8fd9\u4e2a\u4f4d\u7f6e\u540e\u9762\u9700\u8981\u662f\u674e\u56db\u624d\u53ef\u4ee5\u300d\u3002<strong>\u5982\u679c\u6211\u4eec\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u8868\u793a\u8fd9\u4e2a\u4f4d\u7f6e\u7684\u8bdd\uff0c\u90a3\u5c31\u662f(?=\u674e\u56db)\uff0c\u8fd9\u5c31\u8868\u793a\u4e86\u4f60\u60f3\u8981\u627e\u7684\u4f4d\u7f6e\u3002<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>\u5426\u5b9a\u7684\u987a\u5e8f\u73af\u89c6 -&gt; (?!\u674e\u56db)<\/li>\n<\/ol>\n\n\n\n<p>\u5047\u5982\u4f60\u73b0\u5728\u662f\u4e00\u540d\u53eb\u5f20\u4e09\u7684\u5b66\u751f\uff0c\u73b0\u5728\u662f\u4f53\u80b2\u8bfe\u9700\u8981\u5927\u5bb6\u6392\u4e2a\u961f\uff0c\u4f46\u662f<strong>\u4f60\u4e0d\u60f3\u8ba9\u674e\u56db\u7ad9\u5728\u4f60\u7684\u540e\u9762<\/strong>\uff0c\u56e0\u4e3a\u4ed6\u603b\u662f\u559c\u6b22\u7528\u4e2d\u6027\u7b14\u5728\u4f60\u7684\u540e\u80cc\u4e0a\u4e71\u6d82\u4e71\u753b\u3002\u6240\u4ee5\u8fd9\u4e2a\u65f6\u5019\u4f60\u4f1a\u600e\u4e48\u9009\u62e9\u4f4d\u7f6e\u5462\uff1f\u4f60\u80af\u5b9a\u5148\u770b\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u53ea\u8981\u8fd9\u4e2a\u4f4d\u7f6e\u7684\u540e\u9762\u4e0d\u662f\u674e\u56db\u5c31\u53ef\u4ee5\u4e86\u3002\u300c\u56e0\u4e3a\u5c31\u7b97\u674e\u56db\u5728\u4f60\u524d\u9762\u4e5f\u65e0\u6240\u8c13\uff0c\u6bd5\u7adf\u4ed6\u4e0d\u80fd\u753b\u4f60\u7684\u540e\u80cc\u4e86\u3002\u300d<\/p>\n\n\n\n<p>\u6240\u4ee5\u4f60\u505a\u8fd9\u4e2a\u9009\u62e9\u80cc\u540e\u7684\u903b\u8f91\u662f\uff0c\u300c<strong>\u53ea\u6709\u4f60\u7ad9\u7684\u8fd9\u4e2a\u4f4d\u7f6e\u540e\u9762\u4e0d\u662f\u674e\u56db\u624d\u53ef\u4ee5<\/strong>\u300d\u3002<\/p>\n\n\n\n<p><strong>\u4e0a\u9762\u8fd9\u4e2a\u4f4d\u7f6e\u53ef\u4ee5\u7528\u6b63\u5219\u8868\u8fbe\u5f0f(?!\u674e\u56db)\u6765\u8868\u793a<\/strong>\uff0c\u4f5c\u4e3a\u7a0b\u5e8f\u5f00\u53d1\u8005\uff0c\u6211\u4eec\u5bf9!\u5f88\u719f\u6089\uff0c\u5728\u8fd9\u91cc\u4e5f\u662f\u540c\u6837\u7684\u610f\u601d\u3002\u300c\u8868\u793a\u4e0d\u80fd\u591f\u6ee1\u8db3\u540e\u9762\u7684\u6761\u4ef6\u3002\u300d<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>\u80af\u5b9a\u7684\u9006\u5e8f\u73af\u89c6 -&gt; (? (? (?&lt;=\\d)(?=(\\d{3})+$)<\/li>\n<\/ol>\n\n\n\n<p>\u6570\u5b57\u5343\u5206\u4f4d\u7684\u5904\u7406\u3002<strong>\u5f53\u6211\u4eec\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u53bb\u89e3\u51b3\u95ee\u9898\u7684\u65f6\u5019\uff0c\u7b2c\u4e00\u4ef6\u4e8b\u60c5\u5c31\u662f\u9700\u8981\u660e\u786e\u89e3\u51b3\u7684\u662f\u4e00\u4e2a\u4ec0\u4e48\u95ee\u9898\u3002<\/strong>\u5bf9\u4e8e\u8fd9\u4e2a\u95ee\u9898\u6765\u8bf4\uff0c\u6211\u4eec\u8981\u89e3\u51b3\u7684\u95ee\u9898\u662f\u5339\u914d\u4e00\u4e9b\u4f4d\u7f6e\u3002\u4ec0\u4e48\u4f4d\u7f6e\uff1f\u5c31\u662f\u4e00\u4e2a\u6570\u5b57\uff0c\u300c\u4ece\u540e\u5411\u524d\u6570\uff0c\u6bcf\u9694\u4e09\u4e2a\u6570\u5b57\u7684\u4f4d\u7f6e\uff0c\u5e76\u4e14\u6bcf\u4e2a\u4f4d\u7f6e\u7684\u5de6\u8fb9\u90fd\u9700\u8981\u6709\u6570\u5b57\u3002\u300d<\/p>\n\n\n\n<p>\u5f53\u6211\u4eec\u660e\u786e\u4e86\u6211\u4eec\u9700\u8981\u89e3\u51b3\u7684\u95ee\u9898\u4e4b\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5199\u6211\u4eec\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u3002\u9996\u5148\u5199\u4e00\u4e2a\u80fd\u591f\u5339\u914d\u6bcf\u9694\u4e09\u4e2a\u6570\u5b57\u7684\u4f4d\u7f6e\u3002\u8fd9\u4e2a\u6bd4\u8f83\u5bb9\u6613\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u300c\u80af\u5b9a\u7684\u987a\u5e8f\u73af\u89c6\u300d\uff0c(?=\\d{3})\u5e94\u8be5\u662f\u6211\u4eec\u6bd4\u8f83\u5bb9\u6613\u60f3\u5230\u7684\u3002\u8fd9\u4e2a\u6b63\u5219\u8868\u793a\u7684\u610f\u601d\u5c31\u662f\u300c\u5339\u914d\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u8fd9\u4e2a\u4f4d\u7f6e\u7684\u540e\u9762\u9700\u8981\u662f\u4e09\u4e2a\u6570\u5b57\u300d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(?=a) \u524d\u9762\u6709a\n(?!a) \u524d\u9762\u6ca1\u6709a\n\n\u56e0\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\u8fc7\u7a0b\u662f\u4ece\u5de6\u5230\u53f3\u7684\uff0c\u6240\u4ee5\u5982\u679c\u6211\u4eec\u8981\u300c\u5224\u65ad\u4e00\u4e2a\u4f4d\u7f6e\u7684\u53f3\u8fb9\u6ee1\u4e0d\u6ee1\u8db3\u67d0\u4e2a\u6761\u4ef6\uff0c\u8fd9\u5c31\u53eb\u987a\u5e8f\u73af\u89c6\u300d\u3002\u5982\u679c\u6211\u4eec\u300c\u5224\u65ad\u4e00\u4e2a\u4f4d\u7f6e\u7684\u5de6\u8fb9\u6ee1\u4e0d\u6ee1\u8db3\u67d0\u79cd\u6761\u4ef6\u7684\u8bdd\uff0c\u8fd9\u5c31\u53eb\u505a\u9006\u5e8f\u73af\u89c6\u3002\u300d<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u7684\u4e0d\u5339\u914d<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>\/^((?!PART).)*$\/ #\u5339\u914d\u4e0d\u5305\u542b\u5b57\u7b26\u4e32 PART \u7684\u884c\n\/^(?!PART)\/ #\u5339\u914d\u4e0d\u4ee5\u5b57\u7b26\u4e32 PART \u5f00\u5934\u7684\u884c\n\n\u67e5\u627e\u4e0d\u4ee5baidu\u5f00\u5934\u7684\u5b57\u7b26\u4e32 #\u6b63\u5219 ^(?!baidu).+$\n\n\u67e5\u627e\u4ee5com\u7ed3\u5c3e\u7684\u5b57\u7b26\u4e32 #\u6b63\u5219 ^.*?(?&lt;=com)$\n\u67e5\u627e\u4ee5com\u7ed3\u5c3e\u7684\u5b57\u7b26\u4e32 #\u6b63\u5219 ^.*?com$\n\n\u67e5\u627e\u4e0d\u4ee5com\u7ed3\u5c3e\u7684\u5b57\u7b26\u4e32 #\u6b63\u5219 ^.*?(?&lt;!com)$\n\n\u5bf9\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u89e3\u91ca\uff1a^.*?(?&lt;!com)$\n\u9996\u5148\u5339\u914d\u884c\u5f00\u5934\uff0c**\u7136\u540e\u662f .*? \u8fd9\u4e2a\u662f\u5ffd\u7565\u4f18\u5148\uff0c\u4e5f\u5c31\u662f\u4f18\u5148\u5ffd\u7565\u4e0d\u5339\u914d\u4efb\u4f55\u5b57\u7b26**\uff0c(?&lt;!com) \u8fd9\u4e2a\u662f\u4e00\u4e2a\u9006\u5e8f\u73af\u89c6\u7684\u5426\u5b9a\u5f62\u5f0f\uff0c\u610f\u601d\u662f\u5339\u914d\u4e00\u4e2a\u4f4d\u7f6e\u6b64\u4f4d\u7f6e\u7684\u524d\u9762\u4e0d\u80fd\u662f\u5b57\u7b26\u4e32com\uff0c\u6700\u540e\u662f\u4e00\u4e2a\u884c\u7ed3\u675f\u3002\u5bf9\u4e8ewww.123.com\u6765\u8bf4\uff0c\u9996\u5148\u5339\u914d\u884c\u9996\uff0c\u63a5\u7740\u5339\u914dw\u540e\u9762\u7684\u4f4d\u7f6e\uff0c\u53d1\u73b0\u524d\u9762\u4e0d\u662fcom\uff0c\u6240\u4ee5\u6210\u529f\u4f46\u7d27\u63a5\u7740\u8981\u5339\u914d\u884c\u5c3e\uff0c\u5931\u8d25\uff0c\u56de\u6eaf\u8ba9.*? \u5339\u914d\u4e00\u4e2aw\u7b26\u53f7\uff0c\u63a5\u7740(?&lt;com)\u5339\u914d\u7b2c\u4e8c\u4e2aw\u540e\u9762\u7684\u4f4d\u7f6e\uff0c\u53d1\u73b0\u524d\u9762\u4e5f\u4e0d\u662fcom\u5339\u914d\u6210\u529f\uff0c\u7d27\u63a5\u7740\u8981\u5339\u914d$\u5bf9\u5e94\u7684\u884c\u5c3e\u5931\u8d25\uff0c\u4e00\u76f4\u5230.*?\u5339\u914d\u4e86www.baidu.com\u7684\u65f6\u5019\uff0c\u6b64\u65f6(?&lt;!com)\u5339\u914dm\u540e\u9762\u7684\u4f4d\u7f6e\uff0c\u6b64\u65f6\u6b64\u4f4d\u7f6e\u7684\u524d\u9762\u662fcom\u5339\u914d\u76f4\u63a5\u5931\u8d25,\u63a5\u7740.*?\u5339\u914d\u884c\u672b\u5c3e\uff0c(?&lt;!com)\u5339\u914d$\u540e\u9762\u7684\u4f4d\u7f6e\uff0c\u663e\u7136\u8fd9\u6b21\u4e5f\u5931\u8d25\u4e86\uff0c\u6240\u4ee5\u6574\u4e2a\u5168\u5c40\u5339\u914d\u90fd\u5931\u8d25\u3002  www.123.com\u88ab\u6392\u9664\u5230\u5339\u914d\u4e4b\u5916\u3002\u8fd9\u91cc\u7684.*\u540e\u9762\u52a0\u4e0d\u52a0\u95ee\u53f7\u7ed3\u679c\u90fd\u4e00\u6837\u3002\n\n\n\u67e5\u627e\u4e0d\u542b\u6709if\u7684\u884c #\u6b63\u5219 ^(&#91;^f]|&#91;^i]f)+$\n\n\u6392\u9664\u4e0d\u542b\u6709\u67d0\u5b57\u7b26\u4e32\u7684\u6700\u7ec8\u65b9\u6848 #\u6b63\u5219 ^(?!.*helloworld).*$\n\u6392\u9664\u4e0d\u542b\u6709\u67d0\u5b57\u7b26\u4e32\u7684\u6700\u7ec8\u65b9\u6848 #\u6b63\u5219 ^((?!helloworld).)*$ (\u4f46\u6548\u7387\u6ca1\u6709\u4e0a\u9762\u90a3\u4e2a\u9ad8)<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u53c2\u8003\u94fe\u63a5\uff1a<\/h5>\n\n\n\n<p>\u5224\u65ad\u4e00\u884c\u4e2d\u4e0d\u5305\u542b\u7279\u5b9a\u5173\u952e\u5b57\u7684\u6b63\u5219\u8868\u8fbe\u5f0f(Regular expression to match a line that doesn\u2019t contain a word?)<br><a href=\"https:\/\/stackoverflow.com\/questions\/406230\/regular-expression-to-match-a-line-that-doesnt-contain-a-word\">https:\/\/stackoverflow.com\/questions\/406230\/regular-expression-to-match-a-line-that-doesnt-contain-a-word<\/a><\/p>\n\n\n\n<p>\u5229\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6392\u9664\u7279\u5b9a\u5b57\u7b26\u4e32<br><a href=\"http:\/\/www.cnblogs.com\/wangqiguo\/archive\/2012\/05\/08\/2486548.html\">http:\/\/www.cnblogs.com\/wangqiguo\/archive\/2012\/05\/08\/2486548.html<\/a><\/p>\n\n\n\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u91cc\u5b57\u7b26\u4e32\u201d\u4e0d\u5305\u542b\u201d\u5339\u914d\u6280\u5de7<br><a href=\"http:\/\/www.aqee.net\/post\/regular-expression-to-match-string-not-containing-a-word.html\">http:\/\/www.aqee.net\/post\/regular-expression-to-match-string-not-containing-a-word.html<\/a><\/p>\n\n\n\n<p>\u8ddd\u79bb\u5f04\u61c2\u6b63\u5219\u7684\u73af\u89c6\uff0c\u4f60\u53ea\u5dee\u8fd9\u4e00\u7bc7\u6587\u7ae0 #nice<br><a href=\"https:\/\/mp.weixin.qq.com\/s\/VqiZ6fVL20sJ8NUoQJjm2g\">https:\/\/mp.weixin.qq.com\/s\/VqiZ6fVL20sJ8NUoQJjm2g<\/a><\/p>\n\n\n\n<p>\u5e38\u7528\u7684\u6b63\u5219\u8868\u8fbe\u5f0f<br><a href=\"https:\/\/ixyzero.com\/blog\/regex2.html\">https:\/\/ixyzero.com\/blog\/regex2.html<\/a><\/p>\n\n\n\n<p>\u7531\u201c\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u7684\u4e0e\u6216\u975e\u201d\u60f3\u5230\u7684<br><a href=\"https:\/\/ixyzero.com\/blog\/archives\/2059.html\">https:\/\/ixyzero.com\/blog\/archives\/2059.html<\/a><\/p>\n\n\n\n<p>=END=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531\uff1a \u7b80\u5355\u6574\u7406\u8bb0\u5f55\u4e00\u4e0b\u8fd1\u671f\u60f3\u5230\u7684\u4e00\u4e9b\u77e5\u8bc6\u70b9\uff0c\u7ed3\u6784\u6bd4\u8f83\u96f6\u6563\uff0c\u4f46\u662f\u5185\u5bb9\u89c9\u5f97\u8fd8\u6bd4\u8f83\u91cd\u8981\uff0c\u6240\u4ee5\u4e13\u95e8\u5f00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,7,12],"tags":[377,2019,2018,1044,2016,2017],"class_list":["post-5508","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-programing","category-tools","tag-regex","tag-regexp_extract","tag-2018","tag-1044","tag-2016","tag-2017"],"views":1453,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=5508"}],"version-history":[{"count":1,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5508\/revisions"}],"predecessor-version":[{"id":5509,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5508\/revisions\/5509"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=5508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=5508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=5508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}