{"id":95,"date":"2011-11-25T01:40:09","date_gmt":"2011-11-24T17:40:09","guid":{"rendered":"http:\/\/hahacool.com\/?p=95"},"modified":"2016-12-29T22:57:49","modified_gmt":"2016-12-29T14:57:49","slug":"%e5%bc%ba%e6%82%8d%e5%a5%b3%e4%bb%86%e8%88%9e%e8%b9%88-%e7%b2%be%e5%bd%a9%e3%80%82%e3%80%82","status":"publish","type":"post","link":"https:\/\/hahacool.com\/?p=95","title":{"rendered":"PHP \u6b63\u5219\u8868\u8fbe\u5f0f\u8bed\u6cd5"},"content":{"rendered":"<h2>\u6b63\u5219\u8868\u8fbe\u5f0f\u7b80\u4ecb<\/h2>\n<p>\u5728\u67d0\u4e9b\u5e94\u7528\u4e2d\uff0c\u5f80\u5f80\u6709\u65f6\u5019\u9700\u8981\u6839\u636e\u4e00\u5b9a\u7684\u89c4\u5219\u6765\u5339\u914d\uff08\u67e5\u627e\uff09\u786e\u8ba4\u4e00\u4e9b\u5b57\u7b26\u4e32\uff0c\u5982\u8981\u6c42\u7528\u6237\u8f93\u5165\u7684 QQ \u53f7\u7801\u4e3a\u6570\u5b57\u4e14\u81f3\u5c11 5 \u4f4d\u3002\u7528\u4e8e\u63cf\u8ff0\u8fd9\u4e9b\u89c4\u5219\u7684\u5de5\u5177\u5c31\u662f\u6b63\u5219\u8868\u8fbe\u5f0f\u3002<\/p>\n<h3>\u6700\u7b80\u5355\u7684\u5339\u914d<\/h3>\n<p>\u6700\u7b80\u5355\u7684\u5339\u914d\u5c31\u662f\u76f4\u63a5\u7ed9\u5b9a\u5b57\u7b26\u5339\u914d\u3002\u5982\u7528\u5b57\u7b26 a \u53bb\u5339\u914d aabab \uff0c\u5219\u4f1a\u5339\u914d\u51fa 3 \u4e2a\u7ed3\u679c\uff0c\u5206\u522b\u662f\u5b57\u7b26\u4e32\u4e2d\u7684\u7b2c 1\uff0c2 \u548c\u7b2c 4 \u4e2a\u5b57\u7b26\u3002\u8fd9\u79cd\u5339\u914d\u662f\u6700\u7b80\u5355\u7684\u60c5\u51b5\uff0c\u4f46\u5f80\u5f80\u5b9e\u9645\u5904\u7406\u4e2d\u4f1a\u590d\u6742\u5f97\u591a\uff0c\u5982\u4e0b\u9762\u7684 \u201cQQ\u53f7\u7801\u4e3a\u6570\u5b57\u4e14\u81f3\u5c115\u4f4d\u201d \uff0c\u5176\u5bf9\u5e94\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u4e3a\uff1a<\/p>\n<pre>^\\d{5,}$\r\n<\/pre>\n<p>\u8be5\u6b63\u5219\u8868\u8fbe\u5f0f\u5c31\u63cf\u8ff0\u9700\u8981\u786e\u5b9a\u7684\u5185\u5bb9\u4e3a\u81f3\u5c11 5 \u4f4d\u4ee5\u4e0a\u7684\u6570\u5b57\u3002\u6211\u4eec\u6765\u5177\u4f53\u770b\u770b\u8be5\u8868\u8fbe\u5f0f\u662f\u600e\u4e48\u63cf\u8ff0\u8fd9\u4e00\u89c4\u5219\u7684\uff1a<\/p>\n<ol>\n<li>^\uff1a\u8868\u793a\u5339\u914d\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\uff0c\u4e5f\u5373\u8be5\u5b57\u7b26\u4e32\u662f\u72ec\u7acb\u7684\u5f00\u59cb\u800c\u4e0d\u662f\u5305\u542b\u5728\u67d0\u4e2a\u5b57\u7b26\u4e32\u4e4b\u5185<\/li>\n<li>\\d\uff1a\u8868\u793a\u5339\u914d\u6570\u5b57<\/li>\n<li>{5,}\uff1a\u8868\u793a\u81f3\u5c11\u5339\u914d5\u4f4d\u53ca\u4ee5\u4e0a<\/li>\n<li>$\uff1a\u8868\u793a\u5339\u914d\u5b57\u7b26\u4e32\u7684\u7ed3\u675f\uff0c\u4e5f\u5373\u8be5\u5b57\u7b26\u4e32\u662f\u72ec\u7acb\u7684\u7ed3\u675f<\/li>\n<\/ol>\n<p>\u73b0\u5728\u5c31\u5f88\u6e05\u695a\u4e86\uff0c\u8be5\u6b63\u5219\u8868\u8fbe\u5f0f\u7efc\u5408\u8d77\u6765\u5c31\u662f\u5339\u914d 5 \u4f4d\u4ee5\u4e0a\u7684\u8fde\u7eed\u6570\u5b57\uff0c\u4e14\u6709\u72ec\u7acb\u7684\u5f00\u59cb\u548c\u7ed3\u675f\uff0c\u5bf9\u4e8e\u5c11\u4e8e 5 \u4f4d\u7684\u6570\u5b57\uff0c\u6216\u8005\u4e0d\u662f\u4ee5\u6570\u5b57\u5f00\u59cb\u548c\u7ed3\u5c3e\u7684\u5982 a123456b \u8fd9\u6837\u90fd\u662f\u65e0\u6548\u7684\u3002<\/p>\n<p>\u4ece\u8be5\u4f8b\u5b50\u53ef\u4ee5\u770b\u51fa\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4ece\u5de6\u81f3\u53f3\u63cf\u8ff0\u7684\u3002<\/p>\n<p>\u540c\u6837\uff0c\u5982\u679c\u8981\u5339\u914d\u79fb\u52a8\u53f7\u7801\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u4e3a\uff1a<\/p>\n<pre>^1\\d{10}$\r\n<\/pre>\n<h3>\u63d0\u793a<\/h3>\n<p>\u7531\u4e8e\u5bf9\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\u7ed3\u679c\uff0c\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\u90fd\u4e0d\u662f\u90a3\u4e48\u786e\u5b9a\uff0c\u6240\u4ee5\u6700\u597d\u4e0b\u8f7d\u4e00\u4e9b\u8f85\u52a9\u5de5\u5177\u7528\u4e8e\u6d4b\u8bd5\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\u7ed3\u679c\u3002\u8fd9\u7c7b\u5de5\u5177\u5982 Match Tracer\u3001RegExBuilder \u7b49\uff0c\u4ee5\u53ca\u5176\u4ed6\u7c7b\u4f3c\u7684\u5de5\u5177\u4e5f\u53ef\u3002<\/p>\n<h2>\u5143\u5b57\u7b26<\/h2>\n<p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c^ \u3001\\d \u53ca $ \u7b49\u8fd9\u4e9b\u7b26\u53f7\uff0c\u4ee3\u8868\u4e86\u7279\u5b9a\u7684\u5339\u914d\u610f\u4e49\uff0c\u6211\u4eec\u79f0\u4e4b\u4e3a\u5143\u5b57\u7b26\uff0c\u5e38\u7528\u7684\u5143\u5b57\u7b26\u5982\u4e0b\uff1a<\/p>\n<table class=\"table\">\n<tbody>\n<tr>\n<th width=\"15%\">\u5143\u5b57\u7b26<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<tr>\n<td>.<\/td>\n<td>\u5339\u914d\u9664\u6362\u884c\u7b26\u610f\u5916\u7684\u4efb\u610f\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>\\w<\/td>\n<td>\u5339\u914d\u5b57\u6bcd\u6216\u6570\u5b57\u6216\u4e0b\u5212\u7ebf<\/td>\n<\/tr>\n<tr>\n<td>\\s<\/td>\n<td>\u5339\u914d\u4efb\u610f\u7684\u7a7a\u767d\u7b26<\/td>\n<\/tr>\n<tr>\n<td>\\d<\/td>\n<td>\u5339\u914d\u6570\u5b57<\/td>\n<\/tr>\n<tr>\n<td>\\b<\/td>\n<td>\u5339\u914d\u5355\u8bcd\u7684\u5f00\u59cb\u6216\u7ed3\u675f<\/td>\n<\/tr>\n<tr>\n<td>^<\/td>\n<td>\u5339\u914d\u5b57\u7b26\u4e32\u7684\u5f00\u59cb<\/td>\n<\/tr>\n<tr>\n<td>$<\/td>\n<td>\u5339\u914d\u5b57\u7b26\u4e32\u7684\u7ed3\u675f<\/td>\n<\/tr>\n<tr>\n<td>[x]<\/td>\n<td>\u5339\u914dx\u5b57\u7b26\uff0c\u5982\u5339\u914d\u5b57\u7b26\u4e32\u4e2d\u7684 a\u3001b \u548c c \u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>\\W<\/td>\n<td>\\w\u7684\u53cd\u4e49\uff0c\u5373\u5339\u914d\u4efb\u610f\u975e\u5b57\u6bcd\uff0c\u6570\u5b57\uff0c\u4e0b\u5212\u7ebf\u548c\u6c49\u5b57\u7684\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>\\S<\/td>\n<td>\\s\u7684\u53cd\u4e49\uff0c\u5373\u5339\u914d\u4efb\u610f\u975e\u7a7a\u767d\u7b26\u7684\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>\\D<\/td>\n<td>\\d\u7684\u53cd\u4e49\uff0c\u5373\u5339\u914d\u4efb\u610f\u975e\u6570\u5b57\u7684\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>\\B<\/td>\n<td>\\b\u7684\u53cd\u4e49\uff0c\u5373\u4e0d\u662f\u5355\u8bcd\u5f00\u5934\u6216\u7ed3\u675f\u7684\u4f4d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td>[^x]<\/td>\n<td>\u5339\u914d\u9664\u4e86 x \u610f\u5916\u7684\u4efb\u610f\u5b57\u7b26\uff0c\u5982 [^abc] \u5339\u914d\u9664\u4e86 abc \u8fd9\u51e0\u4e2a\u5b57\u6bcd\u4e4b\u5916\u7684\u4efb\u610f\u5b57\u7b26<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u63d0\u793a<\/h3>\n<ol>\n<li>\u5f53\u6211\u4eec\u8981\u5339\u914d\u8fd9\u4e9b\u5143\u5b57\u7b26\u7684\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u7528\u5230\u5b57\u7b26\u8f6c\u4e49\u529f\u80fd\uff0c\u540c\u6837\u6b63\u5219\u8868\u8fbe\u5f0f\u91cc\u9762\u7528 \\ \u6765\u8868\u793a\u8f6c\u4e49\uff0c\u5982\u8981\u5339\u914d . \u7b26\u53f7\uff0c\u5219\u9700\u8981\u7528 \\. \uff0c\u5426\u5219 . \u4f1a\u88ab\u89e3\u91ca\u6210\u201c\u9664\u6362\u884c\u7b26\u5916\u7684\u4efb\u610f\u5b57\u7b26\u201d\u3002\u5f53\u7136\uff0c\u8981\u5339\u914d \\ \uff0c\u5219\u9700\u8981\u5199\u6210 \\\\<\/li>\n<li>\u8fde\u7eed\u7684\u6570\u5b57\u6216\u5b57\u6bcd\u53ef\u4ee5\u7528 \u2013 \u7b26\u53f7\u8fde\u63a5\u8d77\u6765\uff0c\u5982 \u5339\u914d\u6240\u6709\u7684\u5c0f\u5199\u5b57\u6bcd\uff0c[1-5] \u5339\u914d 1 \u81f3 5 \u8fd9 5 \u4e2a\u6570\u5b57<\/li>\n<\/ol>\n<h2>\u91cd\u590d<\/h2>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5a01\u529b\u5728\u4e8e\u5176\u80fd\u591f\u5728\u6a21\u5f0f\u4e2d\u5305\u542b\u9009\u62e9\u548c\u5faa\u73af\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7528\u4e00\u4e9b\u91cd\u590d\u89c4\u5219\u6765\u8868\u8fbe\u5faa\u73af\u5339\u914d\u3002<\/p>\n<p>\u5e38\u7528\u7684\u91cd\u590d\u5982\u4e0b\uff1a<\/p>\n<table class=\"table\">\n<tbody>\n<tr>\n<th width=\"15%\">\u91cd\u590d<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<tr>\n<td>*<\/td>\n<td>\u91cd\u590d\u96f6\u6b21\u6216\u66f4\u591a\u6b21<\/td>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td>\u91cd\u590d 1 \u6b21\u6216\u66f4\u591a\u6b21<\/td>\n<\/tr>\n<tr>\n<td>?<\/td>\n<td>\u91cd\u590d\u96f6\u6b21\u6216 1 \u6b21<\/td>\n<\/tr>\n<tr>\n<td>{n}<\/td>\n<td>\u91cd\u590d n \u6b21<\/td>\n<\/tr>\n<tr>\n<td>{n,}<\/td>\n<td>\u91cd\u590d n \u6b21\u6216\u66f4\u591a\u6b21<\/td>\n<\/tr>\n<tr>\n<td>{n,m}<\/td>\n<td>\u91cd\u590d n \u5230 m \u6b21<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u5206\u679d<\/h2>\n<p>\u5206\u679d\u662f\u6307\u5236\u5b9a\u51e0\u4e2a\u89c4\u5219\uff0c\u5982\u679c\u6ee1\u8db3\u4efb\u610f\u4e00\u79cd\u89c4\u5219\uff0c\u5219\u90fd\u5f53\u4f5c\u5339\u914d\u6210\u529f\u3002\u5177\u4f53\u6765\u8bf4\u5c31\u662f\u7528 | \u7b26\u53f7\u628a\u5404\u79cd\u89c4\u5219\u5206\u5f00\uff0c\u4e14\u6761\u4ef6\u4ece\u5de6\u81f3\u53f3\u5339\u914d\u3002<\/p>\n<h3>\u63d0\u793a<\/h3>\n<p>\u7531\u4e8e\u5206\u679d\u89c4\u5b9a\uff0c\u53ea\u8981\u5339\u914d\u6210\u529f\uff0c\u5c31\u4e0d\u518d\u5bf9\u540e\u9762\u7684\u6761\u4ef6\u52a0\u4ee5\u5339\u914d\uff0c\u6240\u4ee5\u5982\u679c\u4f60\u60f3\u5339\u914d\u6709\u5305\u542b\u5173\u7cfb\u7684\u5185\u5bb9\uff0c\u8bf7\u6ce8\u610f\u89c4\u5219\u7684\u987a\u5e8f\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528\u5206\u679d\u7684\u4f8b\u5b50\u3002<\/p>\n<p>\u7f8e\u56fd\u7684\u90ae\u653f\u7f16\u7801\u7684\u89c4\u5219\u662f 5 \u4e2a\u6570\u5b57\u6216\u8005 5 \u4e2a\u6570\u5b57\u8fde\u4e0a 4 \u4e2a\u6570\u5b57\uff0c\u5982 12345 \u6216\u8005 54321-1234 \uff0c\u5982\u679c\u8981\u5339\u914d\u6240\u6709\u7684\u90ae\u7f16\uff0c\u5219\u6b63\u786e\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u4e3a\uff1a<\/p>\n<pre>\\d{5}-\\d{4}|\\d{5}\r\n\/\/\u9519\u8bef\u5199\u6cd5\r\n\\d{5}|\\d{5}-\\d{4}\r\n<\/pre>\n<p>\u4e0b\u9762\u7684\u9519\u8bef\u5199\u6cd5\uff0c\u53ea\u80fd\u5339\u914d\u5230 5 \u4f4d\u6570\u5b57\u53ca 9 \u4f4d\u6570\u5b57\u7684\u524d 5 \u4f4d\u6570\u5b57\u7684\u60c5\u51b5\uff0c\u800c\u4e0d\u80fd\u5339\u914d 9 \u4f4d\u6570\u5b57\u7684\u90ae\u7f16\u3002<\/p>\n<h2>\u5206\u7ec4<\/h2>\n<p>\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\uff0c\u53ef\u4ee5\u7528\u5c0f\u62ec\u53f7\u5c06\u4e00\u4e9b\u89c4\u5219\u62ec\u8d77\u6765\u5f53\u4f5c\u5206\u7ec4\uff0c\u5206\u7ec4\u53ef\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u5143\u5b57\u7b26\u6765\u770b\u5f85\u3002<\/p>\n<p>\u5206\u7ec4\u7684\u4f8b\u5b50\uff0c\u9a8c\u8bc1 IP \u5730\u5740\uff1a<\/p>\n<pre>(\\d{1,3}\\.){3}\\d{1,3}\r\n<\/pre>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4e14\u4e0d\u5b8c\u5584\u7684\u5339\u914d IP \u5730\u5740\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u56e0\u4e3a\u5b83\u9664\u4e86\u80fd\u5339\u914d\u6b63\u786e\u7684 IP \u5730\u5740\u5916\uff0c\u8fd8\u80fd\u5339\u914d\u5982 322.197.578.888 \u8fd9\u79cd\u4e0d\u5b58\u5728\u7684 IP \u5730\u5740\u3002<\/p>\n<p>\u5f53\u7136\uff0c\u7528\u8fd9\u4e2a\u8868\u8fbe\u5f0f\u7b80\u5355\u5339\u914d\u6210\u529f\u540e\u53ef\u4ee5\u5728\u5229\u7528 PHP \u7684\u7b97\u672f\u6bd4\u8f83\u518d\u52a0\u4ee5\u5224\u65ad IP \u5730\u5740\u662f\u5426\u6b63\u786e\u3002\u800c\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u6ca1\u6709\u63d0\u4f9b\u7b97\u672f\u6bd4\u8f83\u529f\u80fd\uff0c\u5982\u679c\u8981\u5b8c\u5168\u5339\u914d\u6b63\u786e\u7684 IP \u5730\u5740\uff0c\u5219\u9700\u8981\u6539\u8fdb\u5982\u4e0b\uff1a<\/p>\n<pre>((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\r\n<\/pre>\n<h3>\u89c4\u5219\u8bf4\u660e<\/h3>\n<p>\u8be5\u89c4\u5219\u5173\u952e\u4e4b\u5904\u5728\u4e8e\u786e\u5b9a IP \u5730\u5740\u6bcf\u4e00\u6bb5\u8303\u56f4\u4e3a 0-255 \uff0c\u7136\u540e\u518d\u91cd\u590d 4 \u6b21\u5373\u53ef\u3002\u5728\uff1a<\/p>\n<pre>25[0-5]|2[0-4]\\d|[01]?\\d\\d?\r\n<\/pre>\n<p>\u4e2d\uff0c\u7528\u5206\u679d\u9996\u5148\u786e\u5b9a\u4e86 250-255 \u548c 200-249 \u3002 [01]?\\d\\d? \u5219\u786e\u5b9a\u4e86 0-199 \u7684\u8303\u56f4\uff0c\u7efc\u5408\u8d77\u6765\u5c31\u662f 0-255 \u3002<\/p>\n<h2>\u8d2a\u5a6a\u4e0e\u61d2\u60f0<\/h2>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u9ed8\u8ba4\u7684\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u6ee1\u8db3\u5339\u914d\u6761\u4ef6\u4e0b\u5c3d\u53ef\u80fd\u7684\u5339\u914d\u66f4\u591a\u5185\u5bb9\u3002\u5982 a.*b\uff0c\u7528\u4ed6\u6765\u5339\u914d aabab \uff0c\u5b83\u4f1a\u5339\u914d\u6574\u4e2a aabab \uff0c\u800c\u4e0d\u4f1a\u53ea\u5339\u914d\u5230 aab \u4e3a\u6b62\uff0c\u8fd9\u5c31\u662f\u8d2a\u5a6a\u5339\u914d\u3002<\/p>\n<p>\u4e0e\u8d2a\u5a6a\u5339\u914d\u5bf9\u5e94\u7684\u662f\uff0c\u5728\u6ee1\u8db3\u5339\u914d\u6761\u4ef6\u7684\u60c5\u51b5\u4e0b\u5c3d\u53ef\u80fd\u7684\u5339\u914d\u66f4\u5c11\u7684\u5185\u5bb9\uff0c\u8fd9\u5c31\u662f\u61d2\u60f0\u5339\u914d\u3002<\/p>\n<p>\u4e0a\u8ff0\u4f8b\u5b50\u5bf9\u5e94\u7684\u61d2\u60f0\u5339\u914d\u89c4\u5219\u4e3a\uff1a<\/p>\n<pre>a.*?b\r\n<\/pre>\n<p>\u5982\u679c\u7528\u8be5\u8868\u8fbe\u5f0f\u53bb\u5339\u914d aabab \uff0c\u90a3\u4e48\u5c31\u4f1a\u5f97\u5230 aab \u548c ab \u8fd9\u6837\u4e24\u4e2a\u5339\u914d\u7ed3\u679c\u3002<\/p>\n<p>\u5e38\u7528\u7684\u61d2\u60f0\u9650\u5b9a\u7b26\u5982\u4e0b\uff1a<\/p>\n<table class=\"table\">\n<tbody>\n<tr>\n<th width=\"15%\">\u61d2\u60f0\u9650\u5b9a\u7b26<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<tr>\n<td>*?<\/td>\n<td>\u91cd\u590d\u4efb\u610f\u6b21\uff0c\u4f46\u5c3d\u53ef\u80fd\u5c11\u91cd\u590d<\/td>\n<\/tr>\n<tr>\n<td>+?<\/td>\n<td>\u91cd\u590d 1 \u6b21\u6216\u66f4\u591a\u6b21\uff0c\u4f46\u5c3d\u53ef\u80fd\u5c11\u91cd\u590d<\/td>\n<\/tr>\n<tr>\n<td>??<\/td>\n<td>\u91cd\u590d 0 \u6b21\u6216 1 \u6b21\uff0c\u4f46\u5c3d\u53ef\u80fd\u5c11\u91cd\u590d<\/td>\n<\/tr>\n<tr>\n<td>{n,}<\/td>\n<td>\u91cd\u590d n \u6b21\u4ee5\u4e0a\uff0c\u4f46\u5c3d\u53ef\u80fd\u5c11\u91cd\u590d<\/td>\n<\/tr>\n<tr>\n<td>{n,m}<\/td>\n<td>\u91cd\u590d n \u5230 m \u6b21\uff0c\u4f46\u5c3d\u53ef\u80fd\u5c11\u91cd\u590d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u6a21\u5f0f\u4fee\u6b63\u7b26<\/h2>\n<p>\u6a21\u5f0f\u4fee\u6b63\u7b26\u662f\u6807\u8bb0\u5728\u6574\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u4e4b\u5916\u7684\uff0c\u53ef\u4ee5\u770b\u7740\u662f\u5bf9\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u4e00\u4e9b\u8865\u5145\u8bf4\u660e\u3002<\/p>\n<p>\u5e38\u7528\u7684\u6a21\u5f0f\u4fee\u6b63\u7b26\u5982\u4e0b\uff1a<\/p>\n<table class=\"table\">\n<tbody>\n<tr>\n<th width=\"15%\">\u6a21\u5f0f\u4fee\u6b63\u7b26<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<tr>\n<td>i<\/td>\n<td>\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u5c06\u540c\u65f6\u5339\u914d\u5927\u5c0f\u5199\u5b57\u6bcd<\/td>\n<\/tr>\n<tr>\n<td>m<\/td>\n<td>\u5b57\u7b26\u4e32\u89c6\u4e3a\u591a\u884c<\/td>\n<\/tr>\n<tr>\n<td>s<\/td>\n<td>\u5c06\u5b57\u7b26\u4e32\u89c6\u4e3a\u5355\u884c\uff0c\u6362\u884c\u7b26\u4f5c\u4e3a\u666e\u901a\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>x<\/td>\n<td>\u5c06\u6a21\u5f0f\u4e2d\u7684\u7a7a\u767d\u5ffd\u7565<\/td>\n<\/tr>\n<tr>\n<td>e<\/td>\n<td>preg_replace() \u51fd\u6570\u5728\u66ff\u6362\u5b57\u7b26\u4e32\u4e2d\u5bf9\u9006\u5411\u5f15\u7528\u4f5c\u6b63\u5e38\u7684\u66ff\u6362\uff0c\u5c06\u5176\u4f5c\u4e3a PHP \u4ee3\u7801\u6c42\u503c\uff0c\u5e76\u7528\u5176\u7ed3\u679c\u6765\u66ff\u6362\u6240\u641c\u7d22\u7684\u5b57\u7b26\u4e32\u3002<\/td>\n<\/tr>\n<tr>\n<td>A<\/td>\n<td>\u5f3a\u5236\u4ec5\u4ece\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u5f00\u5934\u5f00\u59cb\u5339\u914d<\/td>\n<\/tr>\n<tr>\n<td>D<\/td>\n<td>\u6a21\u5f0f\u4e2d\u7684 $ \u5143\u5b57\u7b26\u4ec5\u5339\u914d\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u7ed3\u5c3e<\/td>\n<\/tr>\n<tr>\n<td>U<\/td>\n<td>\u5339\u914d\u6700\u8fd1\u7684\u5b57\u7b26\u4e32<\/td>\n<\/tr>\n<tr>\n<td>u<\/td>\n<td>\u6a21\u5f0f\u5b57\u7b26\u4e32\u88ab\u5f53\u6210 UTF-8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee5\u4e0a\u8f6c\u8f7d\u81eahttp:\/\/www.5idev.com\/p-php_regular_syntax_2.shtml<\/p>\n<p>\u81ea\u5df1\u53c2\u8003\u7528<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u7b80\u4ecb \u5728\u67d0\u4e9b\u5e94\u7528\u4e2d\uff0c\u5f80\u5f80\u6709\u65f6\u5019\u9700\u8981\u6839\u636e\u4e00\u5b9a\u7684\u89c4\u5219\u6765\u5339\u914d\uff08\u67e5\u627e\uff09\u786e\u8ba4\u4e00\u4e9b\u5b57\u7b26\u4e32\uff0c\u5982\u8981\u6c42\u7528\u6237\u8f93\u5165\u7684 QQ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[166],"tags":[172,173],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-it","tag-172","tag-173"],"views":1044,"_links":{"self":[{"href":"https:\/\/hahacool.com\/index.php?rest_route=\/wp\/v2\/posts\/95"}],"collection":[{"href":"https:\/\/hahacool.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hahacool.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hahacool.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hahacool.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=95"}],"version-history":[{"count":0,"href":"https:\/\/hahacool.com\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions"}],"wp:attachment":[{"href":"https:\/\/hahacool.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hahacool.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hahacool.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}