{"id":655,"date":"2006-08-23T18:56:31","date_gmt":"2006-08-23T06:56:31","guid":{"rendered":""},"modified":"2006-08-23T18:56:31","modified_gmt":"2006-08-23T06:56:31","slug":"","status":"publish","type":"post","link":"https:\/\/www.mudone.com\/?p=655","title":{"rendered":"php\u6b63\u5219\u8868\u8fbe\u5f0f"},"content":{"rendered":"<p>\u5b57\u7b26\/<br \/>\n\u610f\u4e49\uff1a\u5bf9\u4e8e\u5b57\u7b26\uff0c\u901a\u5e38\u8868\u793a\u6309\u5b57\u9762\u610f\u4e49\uff0c\u6307\u51fa\u63a5\u7740\u7684\u5b57\u7b26\u4e3a\u7279\u6b8a\u5b57\u7b26\uff0c\u4e0d\u4f5c\u89e3\u91ca\u3002<br \/>\n\u4f8b\u5982\uff1a\/b\/\u5339\u914d\u5b57\u7b26\u2019b\u2019,\u901a\u8fc7\u5728b \u524d\u9762\u52a0\u4e00\u4e2a\u53cd\u659c\u6760\uff0c\u4e5f\u5c31\u662f\/b\/\uff0c\u5219\u8be5\u5b57\u7b26\u53d8\u6210\u7279\u6b8a\u5b57\u7b26\uff0c\u8868\u793a<br \/>\n\u5339\u914d\u4e00\u4e2a\u5355\u8bcd\u7684\u5206\u754c\u7ebf\u3002<br \/>\n\u6216\u8005\uff1a<br \/>\n\u5bf9\u4e8e\u51e0\u4e2a\u5b57\u7b26\uff0c\u901a\u5e38\u8bf4\u660e\u662f\u7279\u6b8a\u7684\uff0c\u6307\u51fa\u7d27\u63a5\u7740\u7684\u5b57\u7b26\u4e0d\u662f\u7279\u6b8a\u7684\uff0c\u800c\u5e94\u8be5\u6309\u5b57\u9762\u89e3\u91ca\u3002<br \/>\n\u4f8b\u5982\uff1a*\u662f\u4e00\u4e2a\u7279\u6b8a\u5b57\u7b26\uff0c\u5339\u914d\u4efb\u610f\u4e2a\u5b57\u7b26(\u5305\u62ec0\u4e2a\u5b57\u7b26)\uff1b\u4f8b\u5982\uff1a\/a*\/\u610f\u5473\u5339\u914d0\u4e2a\u6216\u591a\u4e2aa\u3002\u4e3a\u4e86\u5339\u914d\u5b57\u9762\u4e0a\u7684*\uff0c\u5728a\u524d\u9762\u52a0\u4e00\u4e2a\u53cd\u659c\u6760\uff1b\u4f8b\u5982\uff1a\/a*\/\u5339\u914d\u2019a*\u2019\u3002<br \/>\n\u5b57\u7b26^<br \/>\n\u610f\u4e49\uff1a\u8868\u793a\u5339\u914d\u7684\u5b57\u7b26\u5fc5\u987b\u5728\u6700\u524d\u8fb9\u3002<br \/>\n\u4f8b\u5982\uff1a\/^A\/\u4e0d\u5339\u914d&quot;an A,&quot;\u4e2d\u7684\u2019A\u2019\uff0c\u4f46\u5339\u914d&quot;An A.&quot;\u4e2d\u6700\u524d\u9762\u7684\u2019A\u2019\u3002 <\/p>\n<p>\u5b57\u7b26$<br \/>\n\u610f\u4e49\uff1a\u4e0e^\u7c7b\u4f3c\uff0c\u5339\u914d\u6700\u672b\u7684\u5b57\u7b26\u3002<br \/>\n\u4f8b\u5982\uff1a\/t$\/\u4e0d\u5339\u914d&quot;eater&quot;\u4e2d\u7684\u2019t\u2019\uff0c\u4f46\u5339\u914d&quot;eat&quot;\u4e2d\u7684\u2019t\u2019\u3002 <\/p>\n<p>\u5b57\u7b26*<br \/>\n\u610f\u4e49\uff1a\u5339\u914d*\u524d\u9762\u7684\u5b57\u7b260\u6b21\u6216n\u6b21\u3002<br \/>\n\u4f8b\u5982:\/bo*\/\u5339\u914d&quot;A ghost booooed&quot;\u4e2d\u7684\u2019boooo\u2019\u6216&quot;A bird warbled&quot;\u4e2d\u7684\u2019b\u2019\uff0c\u4f46\u4e0d\u5339\u914d&quot;Agoat g<br \/>\nrunted&quot;\u4e2d\u7684\u4efb\u4f55\u5b57\u7b26\u3002 <\/p>\n<p>\u5b57\u7b26+<br \/>\n\u610f\u4e49\uff1a\u5339\u914d+\u53f7\u524d\u9762\u7684\u5b57\u7b261\u6b21\u6216n\u6b21\u3002\u7b49\u4ef7\u4e8e{ 1, }\u3002<br \/>\n\u4f8b\u5982\uff1a\/a+\/\u5339\u914d&quot;candy&quot;\u4e2d\u7684\u2019a\u2019\u548c&quot;caaaaaaandy.&quot;\u4e2d\u7684\u6240\u6709\u2019a\u2019\u3002 <\/p>\n<p>\u5b57\u7b26?<br \/>\n\u610f\u4e49\uff1a\u5339\u914d?\u524d\u9762\u7684\u5b57\u7b260\u6b21\u62161\u6b21\u3002<br \/>\n\u4f8b\u5982\uff1a\/e?le?\/\u5339\u914d&quot;angel&quot;\u4e2d\u7684\u2019el\u2019\u548c&quot;angle.&quot;\u4e2d\u7684\u2019le\u2019\u3002 <\/p>\n<p>\u5b57\u7b26.<br \/>\n\u610f\u4e49\uff1a(\u5c0f\u6570\u70b9)\u5339\u914d\u9664\u6362\u884c\u7b26\u5916\u7684\u6240\u6709\u5355\u4e2a\u7684\u5b57\u7b26\u3002<br \/>\n\u4f8b\u5982\uff1a\/.n\/\u5339\u914d&quot;nay, an apple is on the tree&quot;\u4e2d\u7684\u2019an\u2019\u548c\u2019on\u2019\uff0c\u4f46\u4e0d\u5339\u914d\u2019nay\u2019\u3002 <\/p>\n<p>\u5b57\u7b26(x)<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u2019x\u2019\u5e76\u8bb0\u5f55\u5339\u914d\u7684\u503c\u3002<br \/>\n\u4f8b\u5982\uff1a\/(foo)\/\u5339\u914d\u548c\u8bb0\u5f55&quot;foo bar.&quot;\u4e2d\u7684\u2019foo\u2019\u3002\u5339\u914d\u5b50\u4e32\u80fd\u88ab\u7ed3\u679c\u6570\u7ec4\u4e2d\u7684\u7d20[1], &#8230;,[n] \u8fd4<br \/>\n\u56de\uff0c\u6216\u88abRegExp\u5bf9\u8c61\u7684\u5c5e\u6027, &#8230;, \u8fd4\u56de\u3002 <\/p>\n<p>\u5b57\u7b26x\u2502y<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u2019x\u2019\u6216\u8005\u2019y\u2019\u3002<br \/>\n\u4f8b\u5982\uff1a\/green\u2502red\/\u5339\u914d&quot;green apple&quot;\u4e2d\u7684\u2019green\u2019\u548c&quot;red apple.&quot;\u4e2d\u7684\u2019red\u2019\u3002 <\/p>\n<p>\u5b57\u7b26{ n }<br \/>\n\u610f\u4e49\uff1a\u8fd9\u91cc\u7684n\u662f\u4e00\u4e2a\u6b63\u6574\u6570\u3002\u5339\u914d\u524d\u9762\u7684n\u4e2a\u5b57\u7b26\u3002<br \/>\n\u4f8b\u5982\uff1a\/a{ 2 }\/\u4e0d\u5339\u914d&quot;candy,&quot;\u4e2d\u7684\u2019a\u2019\uff0c\u4f46\u5339\u914d&quot;caandy,&quot; \u4e2d\u7684\u6240\u6709\u2019a\u2019\u548c&quot;caaandy.&quot;\u4e2d\u524d\u9762\u7684\u4e24\u4e2a\u2019a\u2019\u3002<br \/>\n<!--more--><br \/>\n\u5b57\u7b26{ n, }<br \/>\n\u610f\u4e49\uff1a\u8fd9\u91cc\u7684n\u662f\u4e00\u4e2a\u6b63\u6574\u6570\u3002\u5339\u914d\u81f3\u5c11n\u4e2a\u524d\u9762\u7684\u5b57\u7b26\u3002<br \/>\n\u4f8b\u5982\uff1a\/a{ 2, }\u4e0d\u5339\u914d&quot;candy&quot;\u4e2d\u7684\u2019a\u2019\uff0c\u4f46\u5339\u914d&quot;caandy&quot;\u4e2d\u7684\u6240\u6709\u2019a\u2019\u548c&quot;caaaaaaandy.&quot;\u4e2d\u7684\u6240\u6709\u2019a\u2019 <\/p>\n<p>\u5b57\u7b26{ n,m }<br \/>\n\u610f\u4e49\uff1a\u8fd9\u91cc\u7684n\u548cm\u90fd\u662f\u6b63\u6574\u6570\u3002\u5339\u914d\u81f3\u5c11n\u4e2a\u6700\u591am\u4e2a\u524d\u9762\u7684\u5b57\u7b26\u3002<br \/>\n\u4f8b\u5982\uff1a\/a{ 1,3 }\/\u4e0d\u5339\u914d&quot;cndy&quot;\u4e2d\u7684\u4efb\u4f55\u5b57\u7b26\uff0c\u4f46\u5339\u914d &quot;candy,&quot;\u4e2d\u7684\u2019a\u2019\uff0c&quot;caandy,&quot; \u4e2d\u7684\u524d\u9762\u4e24\u4e2a<br \/>\n\u2019a\u2019\u548c&quot;caaaaaaandy&quot;\u4e2d\u524d\u9762\u7684\u4e09\u4e2a\u2019a\u2019\uff0c\u6ce8\u610f\uff1a\u5373\u4f7f&quot;caaaaaaandy&quot; \u4e2d\u6709\u5f88\u591a\u4e2a\u2019a\u2019\uff0c\u4f46\u53ea\u5339\u914d\u524d\u9762\u7684\u4e09 \u4e2a\u2019a\u2019\u5373&quot;aaa&quot;\u3002 <\/p>\n<p>\u5b57\u7b26[xyz]<br \/>\n\u610f\u4e49\uff1a\u4e00\u5b57\u7b26\u5217\u8868\uff0c\u5339\u914d\u5217\u51fa\u4e2d\u7684\u4efb\u4e00\u5b57\u7b26\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u8fde\u5b57\u7b26-\u6307\u51fa\u4e00\u4e2a\u5b57\u7b26\u8303\u56f4\u3002<br \/>\n\u4f8b\u5982\uff1a[abcd]\u8ddf[a-c]\u4e00\u6837\u3002\u5b83\u4eec\u5339\u914d&quot;brisket&quot;\u4e2d\u7684\u2019b\u2019\u548c&quot;ache&quot;\u4e2d\u7684\u2019c\u2019\u3002 <\/p>\n<p>\u5b57\u7b26[^xyz]<br \/>\n\u610f\u4e49\uff1a\u4e00\u5b57\u7b26\u8865\u96c6\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b83\u5339\u914d\u9664\u4e86\u5217\u51fa\u7684\u5b57\u7b26\u5916\u7684\u6240\u6709\u4e1c\u897f\u3002 \u4f60\u53ef\u4ee5\u4f7f\u7528\u8fde\u5b57\u7b26-\u6307\u51fa\u4e00 \u5b57\u7b26\u8303\u56f4\u3002<br \/>\n\u4f8b\u5982\uff1a[^abc]\u548c[^a-c]\u7b49\u4ef7\uff0c\u5b83\u4eec\u6700\u65e9\u5339\u914d&quot;brisket&quot;\u4e2d\u7684\u2019r\u2019\u548c&quot;chop.&quot;\u4e2d\u7684\u2019h\u2019\u3002 <\/p>\n<p>\u5b57\u7b26<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u7a7a\u683c(\u4e0d\u8981\u4e0eb\u6df7\u6dc6) <\/p>\n<p>\u5b57\u7b26b<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u5355\u8bcd\u7684\u5206\u754c\u7ebf\uff0c\u6bd4\u5982\u4e00\u4e2a\u7a7a\u683c(\u4e0d\u8981\u4e0e\u6df7\u6dc6)<br \/>\n\u4f8b\u5982\uff1a\/bnw\/\u5339\u914d&quot;noonday&quot;\u4e2d\u7684\u2019no\u2019\uff0c\/wyb\/\u5339\u914d&quot;possibly yesterday.&quot;\u4e2d\u7684\u2019ly\u2019\u3002 <\/p>\n<p>\u5b57\u7b26B<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u5355\u8bcd\u7684\u975e\u5206\u754c\u7ebf<br \/>\n\u4f8b\u5982\uff1a\/wBn\/\u5339\u914d&quot;noonday&quot;\u4e2d\u7684\u2019on\u2019\uff0c\/yBw\/\u5339\u914d&quot;possibly yesterday.&quot;\u4e2d\u7684\u2019ye\u2019\u3002 <\/p>\n<p>\u5b57\u7b26cX<br \/>\n\u610f\u4e49\uff1a\u8fd9\u91cc\u7684X\u662f\u4e00\u4e2a\u63a7\u5236\u5b57\u7b26\u3002\u5339\u914d\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684\u63a7\u5236\u5b57\u7b26\u3002<br \/>\n\u4f8b\u5982\uff1a\/cM\/\u5339\u914d\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e2d\u7684control-M\u3002 <\/p>\n<p>\u5b57\u7b26d<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u6570\u5b57\uff0c\u7b49\u4ef7\u4e8e[0-9]\u3002<br \/>\n\u4f8b\u5982\uff1a\/d\/\u6216\/[0-9]\/\u5339\u914d&quot;B2 is the suite number.&quot;\u4e2d\u7684\u20192\u2019\u3002 <\/p>\n<p>\u5b57\u7b26D<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4efb\u4f55\u7684\u975e\u6570\u5b57\uff0c\u7b49\u4ef7\u4e8e[^0-9]\u3002<br \/>\n\u4f8b\u5982\uff1a\/D\/\u6216\/[^0-9]\/\u5339\u914d&quot;B2 is the suite number.&quot;\u4e2d\u7684\u2019B\u2019\u3002 <\/p>\n<p>\u5b57\u7b26f<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u8868\u5355\u7b26 <\/p>\n<p>\u5b57\u7b26n<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u6362\u884c\u7b26 <\/p>\n<p>\u5b57\u7b26r<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u56de\u8f66\u7b26 <\/p>\n<p>\u5b57\u7b26s<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u5355\u4e2awhite\u7a7a\u683c\u7b26\uff0c\u5305\u62ec\u7a7a\u683c\uff0ctab\uff0cform feed\uff0c\u6362\u884c\u7b26\uff0c\u7b49\u4ef7\u4e8e[ fnrtv]\u3002<br \/>\n\u4f8b\u5982\uff1a\/sw*\/\u5339\u914d&quot;foo bar.&quot;\u4e2d\u7684\u2019 bar\u2019\u3002 <\/p>\n<p>\u5b57\u7b26S<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u9664white\u7a7a\u683c\u7b26\u4ee5\u5916\u7684\u4e00\u4e2a\u5355\u4e2a\u7684\u5b57\u7b26\uff0c\u7b49\u4ef7\u4e8e[^ fnrtv]\u3002<br \/>\n\u4f8b\u5982\uff1a\/S\/w*\u5339\u914d&quot;foo bar.&quot;\u4e2d\u7684\u2019foo\u2019\u3002 <\/p>\n<p>\u5b57\u7b26t<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u5236\u8868\u7b26 <\/p>\n<p>\u5b57\u7b26v<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u4e00\u4e2a\u9876\u5934\u5236\u8868\u7b26 <\/p>\n<p>\u5b57\u7b26w<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u6240\u6709\u7684\u6570\u5b57\u548c\u5b57\u6bcd\u4ee5\u53ca\u4e0b\u5212\u7ebf\uff0c\u7b49\u4ef7\u4e8e[A-Za-z0-9_]\u3002<br \/>\n\u4f8b\u5982\uff1a\/w\/\u5339\u914d&quot;apple,&quot;\u4e2d\u7684\u2019a\u2019\uff0c&quot;.28,&quot;\u4e2d\u7684\u20195\u2019\u548c&quot;3D.&quot;\u4e2d\u7684\u20193\u2019\u3002 <\/p>\n<p>\u5b57\u7b26W<br \/>\n\u610f\u4e49\uff1a\u5339\u914d\u9664\u6570\u5b57\u3001\u5b57\u6bcd\u5916\u53ca\u4e0b\u5212\u7ebf\u5916\u7684\u5176\u5b83\u5b57\u7b26\uff0c\u7b49\u4ef7\u4e8e[^A-Za-z0-9_]\u3002<br \/>\n\u4f8b\u5982\uff1a\/W\/\u6216\u8005\/[^$A-Za-z0-9_]\/\u5339\u914d&quot;50%.&quot;\u4e2d\u7684\u2019%\u2019\u3002 <\/p>\n<p>\u5b57\u7b26n<br \/>\n\u610f\u4e49\uff1a\u8fd9\u91cc\u7684n\u662f\u4e00\u4e2a\u6b63\u6574\u6570\u3002\u5339\u914d\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u6700\u540e\u4e00\u4e2a\u5b50\u4e32\u7684n\u7684\u503c(\u8ba1\u6570\u5de6\u5706\u62ec\u53f7)\u3002 <\/p>\n<p>\u4f8b\u5982\uff1a\/apple(,)sorange1\/\u5339\u914d&quot;apple, orange, cherry, peach.&quot;\u4e2d\u7684\u2019apple, orange\u2019\uff0c\u4e0b\u9762\u6709\u4e00\u4e2a\u66f4\u52a0\u5b8c\u6574\u7684\u4f8b\u5b50\u3002<br \/>\n\u6ce8\u610f\uff1a\u5982\u679c\u5de6\u5706\u62ec\u53f7\u4e2d\u7684\u6570\u5b57\u6bd4n\u6307\u5b9a\u7684\u6570\u5b57\u8fd8\u5c0f\uff0c\u5219n\u53d6\u4e0b\u4e00\u884c\u7684\u516b\u8fdb\u5236escape\u4f5c\u4e3a\u63cf\u8ff0\u3002 <\/p>\n<p>\u5b57\u7b26ooctal\u548cxhex<br \/>\n\u610f\u4e49\uff1a\u8fd9\u91cc\u7684ooctal\u662f\u4e00\u4e2a\u516b\u8fdb\u5236\u7684escape\u503c\uff0c\u800cxhex\u662f\u4e00\u4e2a\u5341\u516d\u8fdb\u5236\u7684escape\u503c\uff0c\u5141\u8bb8\u5728\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5d4c\u5165ASCII\u7801 <\/p>\n<p>\u9644:\u4e0b\u8868\u662f\u5143\u5b57\u7b26\u53ca\u5176\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e0a\u4e0b\u6587\u4e2d\u7684\u884c\u4e3a\u7684\u4e00\u4e2a\u5b8c\u6574\u5217\u8868\uff1a <\/p>\n<p>\u5b57\u7b26 \u63cf\u8ff0<br \/>\n\u5c06\u4e0b\u4e00\u4e2a\u5b57\u7b26\u6807\u8bb0\u4e3a\u4e00\u4e2a\u7279\u6b8a\u5b57\u7b26\u3001\u6216\u4e00\u4e2a\u539f\u4e49\u5b57\u7b26\u3001\u6216\u4e00\u4e2a \u540e\u5411\u5f15\u7528\u3001\u6216\u4e00\u4e2a\u516b\u8fdb\u5236\u8f6c\u4e49\u7b26\u3002\u4f8b\u5982\uff0c&#39;n&#39; \u5339\u914d\u5b57\u7b26 &quot;n&quot;\u3002&#39; &#39; \u5339\u914d\u4e00\u4e2a\u6362\u884c\u7b26\u3002\u5e8f\u5217 &#39;&#39; \u5339\u914d &quot;&quot; \u800c &quot;(&quot; \u5219\u5339\u914d &quot;(&quot;\u3002<br \/>\n^ \u5339\u914d\u8f93\u5165\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\u4f4d\u7f6e\u3002\u5982\u679c\u8bbe\u7f6e\u4e86 RegExp \u5bf9\u8c61\u7684 Multiline \u5c5e\u6027\uff0c^ \u4e5f\u5339\u914d &#39; &#39; \u6216 &#39; &#39; \u4e4b\u540e\u7684\u4f4d\u7f6e\u3002<br \/>\n$ \u5339\u914d\u8f93\u5165\u5b57\u7b26\u4e32\u7684\u7ed3\u675f\u4f4d\u7f6e\u3002\u5982\u679c\u8bbe\u7f6e\u4e86RegExp \u5bf9\u8c61\u7684 Multiline \u5c5e\u6027\uff0c$ \u4e5f\u5339\u914d &#39; &#39; \u6216 &#39; &#39; \u4e4b\u524d\u7684\u4f4d\u7f6e\u3002<br \/>\n* \u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u96f6\u6b21\u6216\u591a\u6b21\u3002\u4f8b\u5982\uff0czo* \u80fd\u5339\u914d &quot;z&quot; \u4ee5\u53ca &quot;zoo&quot;\u3002 * \u7b49\u4ef7\u4e8e{0,}\u3002<br \/>\n+ \u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u4e00\u6b21\u6216\u591a\u6b21\u3002\u4f8b\u5982\uff0c&#39;zo+&#39; \u80fd\u5339\u914d &quot;zo&quot; \u4ee5\u53ca &quot;zoo&quot;\uff0c\u4f46\u4e0d\u80fd\u5339\u914d &quot;z&quot;\u3002+ \u7b49\u4ef7\u4e8e {1,}\u3002<br \/>\n? \u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u96f6\u6b21\u6216\u4e00\u6b21\u3002\u4f8b\u5982\uff0c&quot;do(es)?&quot; \u53ef\u4ee5\u5339\u914d &quot;do&quot; \u6216 &quot;does&quot; \u4e2d\u7684&quot;do&quot; \u3002? \u7b49\u4ef7\u4e8e {0,1}\u3002<br \/>\n{n} n \u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u3002\u5339\u914d\u786e\u5b9a\u7684 n \u6b21\u3002\u4f8b\u5982\uff0c&#39;o{2}&#39; \u4e0d\u80fd\u5339\u914d &quot;Bob&quot; \u4e2d\u7684 &#39;o&#39;\uff0c\u4f46\u662f\u80fd\u5339\u914d &quot;food&quot; \u4e2d\u7684\u4e24\u4e2a o\u3002<br \/>\n{n,} n \u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u3002\u81f3\u5c11\u5339\u914dn \u6b21\u3002\u4f8b\u5982\uff0c&#39;o{2,}&#39; \u4e0d\u80fd\u5339\u914d &quot;Bob&quot; \u4e2d\u7684 &#39;o&#39;\uff0c\u4f46\u80fd\u5339\u914d &quot;foooood&quot; \u4e2d\u7684\u6240\u6709 o\u3002&#39;o{1,}&#39; \u7b49\u4ef7\u4e8e &#39;o+&#39;\u3002&#39;o{0,}&#39; \u5219\u7b49\u4ef7\u4e8e &#39;o*&#39;\u3002<br \/>\n{n,m} m \u548c n \u5747\u4e3a\u975e\u8d1f\u6574\u6570\uff0c\u5176\u4e2dn &lt;= m\u3002\u6700\u5c11\u5339\u914d n \u6b21\u4e14\u6700\u591a\u5339\u914d m \u6b21\u3002\u5218\uff0c &quot;o{1,3}&quot; \u5c06\u5339\u914d &quot;fooooood&quot; \u4e2d\u7684\u524d\u4e09\u4e2a o\u3002&#39;o{0,1}&#39; \u7b49\u4ef7\u4e8e &#39;o?&#39;\u3002\u8bf7\u6ce8\u610f\u5728\u9017\u53f7\u548c\u4e24\u4e2a\u6570\u4e4b\u95f4\u4e0d\u80fd\u6709\u7a7a\u683c\u3002<br \/>\n? \u5f53\u8be5\u5b57\u7b26\u7d27\u8ddf\u5728\u4efb\u4f55\u4e00\u4e2a\u5176\u4ed6\u9650\u5236\u7b26 (*, +, ?, {n}, {n,}, {n,m}) \u540e\u9762\u65f6\uff0c\u5339\u914d\u6a21\u5f0f\u662f\u975e\u8d2a\u5a6a\u7684\u3002\u975e\u8d2a\u5a6a\u6a21\u5f0f\u5c3d\u53ef\u80fd\u5c11\u7684\u5339\u914d\u6240\u641c\u7d22\u7684\u5b57\u7b26\u4e32\uff0c\u800c\u9ed8\u8ba4\u7684\u8d2a\u5a6a\u6a21\u5f0f\u5219\u5c3d\u53ef\u80fd\u591a\u7684\u5339\u914d\u6240\u641c\u7d22\u7684\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u5b57\u7b26\u4e32 &quot;oooo&quot;\uff0c&#39;o+?&#39; \u5c06\u5339\u914d\u5355\u4e2a &quot;o&quot;\uff0c\u800c &#39;o+&#39; \u5c06\u5339\u914d\u6240\u6709 &#39;o&#39;\u3002<br \/>\n. \u5339\u914d\u9664 &quot; &quot; \u4e4b\u5916\u7684\u4efb\u4f55\u5355\u4e2a\u5b57\u7b26\u3002\u8981\u5339\u914d\u5305\u62ec &#39; &#39; \u5728\u5185\u7684\u4efb\u4f55\u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528\u8c61 &#39;[. ]&#39; \u7684\u6a21\u5f0f\u3002<br \/>\n(pattern) \u5339\u914dpattern \u5e76\u83b7\u53d6\u8fd9\u4e00\u5339\u914d\u3002\u6240\u83b7\u53d6\u7684\u5339\u914d\u53ef\u4ee5\u4ece\u4ea7\u751f\u7684 Matches \u96c6\u5408\u5f97\u5230\uff0c\u5728VBScript \u4e2d\u4f7f\u7528 SubMatches \u96c6\u5408\uff0c\u5728JScript \u4e2d\u5219\u4f7f\u7528 {CONTENT}\u2026 \u5c5e\u6027\u3002\u8981\u5339\u914d\u5706\u62ec\u53f7\u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528 &#39;(&#39; \u6216 &#39;)&#39;\u3002<br \/>\n(?:pattern) \u5339\u914d pattern \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\u8fd9\u5728\u4f7f\u7528 &quot;\u6216&quot; \u5b57\u7b26 (\u2502) \u6765\u7ec4\u5408\u4e00\u4e2a\u6a21\u5f0f\u7684\u5404\u4e2a\u90e8\u5206\u662f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c &#39;industr(?:y\u2502ies) \u5c31\u662f\u4e00\u4e2a\u6bd4 &#39;industry\u2502industries&#39; \u66f4\u7b80\u7565\u7684\u8868\u8fbe\u5f0f\u3002<br \/>\n(?=pattern) \u6b63\u5411\u9884\u67e5\uff0c\u5728\u4efb\u4f55\u5339\u914d 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 &#39;Windows (?=95\u250298\u2502NT\u25022000)&#39; \u80fd\u5339\u914d &quot;Windows 2000&quot; \u4e2d\u7684 &quot;Windows&quot; \uff0c\u4f46\u4e0d\u80fd\u5339\u914d &quot;Windows 3.1&quot; \u4e2d\u7684 &quot;Windows&quot;\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<br \/>\n(?!pattern) \u8d1f\u5411\u9884\u67e5\uff0c\u5728\u4efb\u4f55\u4e0d\u5339\u914dNegative lookahead matches the search string at any point where a string not matching 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&#39;Windows (?!95\u250298\u2502NT\u25022000)&#39; \u80fd\u5339\u914d &quot;Windows 3.1&quot; \u4e2d\u7684 &quot;Windows&quot;\uff0c\u4f46\u4e0d\u80fd\u5339\u914d &quot;Windows 2000&quot; \u4e2d\u7684 &quot;Windows&quot;\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<br \/>\nx\u2502y \u5339\u914d x \u6216 y\u3002\u4f8b\u5982\uff0c&#39;z\u2502food&#39; \u80fd\u5339\u914d &quot;z&quot; \u6216 &quot;food&quot;\u3002&#39;(z\u2502f)ood&#39; \u5219\u5339\u914d &quot;zood&quot; \u6216 &quot;food&quot;\u3002<br \/>\n[xyz] \u5b57\u7b26\u96c6\u5408\u3002\u5339\u914d\u6240\u5305\u542b\u7684\u4efb\u610f\u4e00\u4e2a\u5b57\u7b26\u3002\u4f8b\u5982\uff0c &#39;[abc]&#39; \u53ef\u4ee5\u5339\u914d &quot;plain&quot; \u4e2d\u7684 &#39;a&#39;\u3002<br \/>\n[^xyz] \u8d1f\u503c\u5b57\u7b26\u96c6\u5408\u3002\u5339\u914d\u672a\u5305\u542b\u7684\u4efb\u610f\u5b57\u7b26\u3002\u4f8b\u5982\uff0c &#39;[^abc]&#39; \u53ef\u4ee5\u5339\u914d &quot;plain&quot; \u4e2d\u7684&#39;p&#39;\u3002<br \/>\n[a-z] \u5b57\u7b26\u8303\u56f4\u3002\u5339\u914d\u6307\u5b9a\u8303\u56f4\u5185\u7684\u4efb\u610f\u5b57\u7b26\u3002\u4f8b\u5982\uff0c&#39;[a-z]&#39; \u53ef\u4ee5\u5339\u914d &#39;a&#39; \u5230 &#39;z&#39; \u8303\u56f4\u5185\u7684\u4efb\u610f\u5c0f\u5199\u5b57\u6bcd\u5b57\u7b26\u3002<br \/>\n[^a-z] \u8d1f\u503c\u5b57\u7b26\u8303\u56f4\u3002\u5339\u914d\u4efb\u4f55\u4e0d\u5728\u6307\u5b9a\u8303\u56f4\u5185\u7684\u4efb\u610f\u5b57\u7b26\u3002\u4f8b\u5982\uff0c&#39;[^a-z]&#39; \u53ef\u4ee5\u5339\u914d\u4efb\u4f55\u4e0d\u5728 &#39;a&#39; \u5230 &#39;z&#39; \u8303\u56f4\u5185\u7684\u4efb\u610f\u5b57\u7b26\u3002<br \/>\n\b \u5339\u914d\u4e00\u4e2a\u5355\u8bcd\u8fb9\u754c\uff0c\u4e5f\u5c31\u662f\u6307\u5355\u8bcd\u548c\u7a7a\u683c\u95f4\u7684\u4f4d\u7f6e\u3002\u4f8b\u5982\uff0c &#39;er\b&#39; \u53ef\u4ee5\u5339\u914d&quot;never&quot; \u4e2d\u7684 &#39;er&#39;\uff0c\u4f46\u4e0d\u80fd\u5339\u914d &quot;verb&quot; \u4e2d\u7684 &#39;er&#39;\u3002<br \/>\nB \u5339\u914d\u975e\u5355\u8bcd\u8fb9\u754c\u3002&#39;erB&#39; \u80fd\u5339\u914d &quot;verb&quot; \u4e2d\u7684 &#39;er&#39;\uff0c\u4f46\u4e0d\u80fd\u5339\u914d &quot;never&quot; \u4e2d\u7684 &#39;er&#39;\u3002<br \/>\ncx \u5339\u914d\u7531x\u6307\u660e\u7684\u63a7\u5236\u5b57\u7b26\u3002\u4f8b\u5982\uff0c cM \u5339\u914d\u4e00\u4e2a Control-M \u6216\u56de\u8f66\u7b26\u3002 x \u7684\u503c\u5fc5\u987b\u4e3a A-Z \u6216 a-z \u4e4b\u4e00\u3002\u5426\u5219\uff0c\u5c06 c \u89c6\u4e3a\u4e00\u4e2a\u539f\u4e49\u7684 &#39;c&#39; \u5b57\u7b26\u3002<br \/>\nd \u5339\u914d\u4e00\u4e2a\u6570\u5b57\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e [0-9]\u3002<br \/>\nD \u5339\u914d\u4e00\u4e2a\u975e\u6570\u5b57\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e [^0-9]\u3002<br \/>\nf \u5339\u914d\u4e00\u4e2a\u6362\u9875\u7b26\u3002\u7b49\u4ef7\u4e8e x0c \u548c cL\u3002<br \/>\n\u5339\u914d\u4e00\u4e2a\u6362\u884c\u7b26\u3002\u7b49\u4ef7\u4e8e x0a \u548c cJ\u3002<br \/>\n\u5339\u914d\u4e00\u4e2a\u56de\u8f66\u7b26\u3002\u7b49\u4ef7\u4e8e x0d \u548c cM\u3002<br \/>\ns \u5339\u914d\u4efb\u4f55\u7a7a\u767d\u5b57\u7b26\uff0c\u5305\u62ec\u7a7a\u683c\u3001\u5236\u8868\u7b26\u3001\u6362\u9875\u7b26\u7b49\u7b49\u3002\u7b49\u4ef7\u4e8e [ f v]\u3002<br \/>\nS \u5339\u914d\u4efb\u4f55\u975e\u7a7a\u767d\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e [^ f v]\u3002<br \/>\n\u5339\u914d\u4e00\u4e2a\u5236\u8868\u7b26\u3002\u7b49\u4ef7\u4e8e x09 \u548c cI\u3002<br \/>\nv \u5339\u914d\u4e00\u4e2a\u5782\u76f4\u5236\u8868\u7b26\u3002\u7b49\u4ef7\u4e8e x0b \u548c cK\u3002<br \/>\nw \u5339\u914d\u5305\u62ec\u4e0b\u5212\u7ebf\u7684\u4efb\u4f55\u5355\u8bcd\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e&#39;[A-Za-z0-9_]&#39;\u3002<br \/>\nW \u5339\u914d\u4efb\u4f55\u975e\u5355\u8bcd\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e &#39;[^A-Za-z0-9_]&#39;\u3002<br \/>\nxn \u5339\u914d n\uff0c\u5176\u4e2d n \u4e3a\u5341\u516d\u8fdb\u5236\u8f6c\u4e49\u503c\u3002\u5341\u516d\u8fdb\u5236\u8f6c\u4e49\u503c\u5fc5\u987b\u4e3a\u786e\u5b9a\u7684\u4e24\u4e2a\u6570\u5b57\u957f\u3002\u4f8b\u5982\uff0c &#39;x41&#39; \u5339\u914d &quot;A&quot;\u3002&#39;x041&#39; \u5219\u7b49\u4ef7\u4e8e &#39;x04&#39; &amp; &quot;1&quot;\u3002\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u53ef\u4ee5\u4f7f\u7528 ASCII \u7f16\u7801\u3002.<br \/>\num \u5339\u914d num\uff0c\u5176\u4e2d num \u662f\u4e00\u4e2a\u6b63\u6574\u6570\u3002\u5bf9\u6240\u83b7\u53d6\u7684\u5339\u914d\u7684\u5f15\u7528\u3002\u4f8b\u5982\uff0c&#39;(.)&#39; \u5339\u914d\u4e24\u4e2a\u8fde\u7eed\u7684\u76f8\u540c\u5b57\u7b26\u3002<br \/>\n\u6807\u8bc6\u4e00\u4e2a\u516b\u8fdb\u5236\u8f6c\u4e49\u503c\u6216\u4e00\u4e2a\u540e\u5411\u5f15\u7528\u3002\u5982\u679c \u4e4b\u524d\u81f3\u5c11 n \u4e2a\u83b7\u53d6\u7684\u5b50\u8868\u8fbe\u5f0f\uff0c\u5219 n \u4e3a\u540e\u5411\u5f15\u7528\u3002\u5426\u5219\uff0c\u5982\u679c n \u4e3a\u516b\u8fdb\u5236\u6570\u5b57 (0-7)\uff0c\u5219 n \u4e3a\u4e00\u4e2a\u516b\u8fdb\u5236\u8f6c\u4e49\u503c\u3002<br \/>\nm \u6807\u8bc6\u4e00\u4e2a\u516b\u8fdb\u5236\u8f6c\u4e49\u503c\u6216\u4e00\u4e2a\u540e\u5411\u5f15\u8c29\uff28\u7efb? m \u4e4b\u524d\u81f3\u5c11\u6709is preceded by at least nm \u4e2a\u83b7\u53d6\u5f97\u5b50\u8868\u8fbe\u5f0f\uff0c\u5219 nm \u4e3a\u540e\u5411\u5f15\u7528\u3002\u5982\u679c m \u4e4b\u524d\u81f3\u5c11\u6709 n \u4e2a\u83b7\u53d6\uff0c\u5219 n \u4e3a\u4e00\u4e2a\u540e\u8ddf\u6587\u5b57 m \u7684\u540e\u5411\u5f15\u7528\u3002\u5982\u679c\u524d\u9762\u7684\u6761\u4ef6\u90fd\u4e0d\u6ee1\u8db3\uff0c\u82e5 n \u548c m \u5747\u4e3a\u516b\u8fdb\u5236\u6570\u5b57 (0-7)\uff0c\u5219 m \u5c06\u5339\u914d\u516b\u8fdb\u5236\u8f6c\u4e49\u503c nm\u3002<br \/>\nml \u5982\u679c n \u4e3a\u516b\u8fdb\u5236\u6570\u5b57 (0-3)\uff0c\u4e14 m \u548c l \u5747\u4e3a\u516b\u8fdb\u5236\u6570\u5b57 (0-7)\uff0c\u5219\u5339\u914d\u516b\u8fdb\u5236\u8f6c\u4e49\u503c nml\u3002<br \/>\nun \u5339\u914d n\uff0c\u5176\u4e2d n \u662f\u4e00\u4e2a\u7528\u56db\u4e2a\u5341\u516d\u8fdb\u5236\u6570\u5b57\u8868\u793a\u7684 Unicode \u5b57\u7b26\u3002\u4f8b\u5982\uff0c u00A9 \u5339\u914d\u7248\u6743\u7b26\u53f7 (?)\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b57\u7b26\/ \u610f\u4e49\uff1a\u5bf9\u4e8e\u5b57\u7b26\uff0c\u901a\u5e38\u8868\u793a\u6309\u5b57\u9762\u610f\u4e49\uff0c\u6307\u51fa\u63a5\u7740\u7684\u5b57\u7b26\u4e3a\u7279\u6b8a\u5b57\u7b26\uff0c\u4e0d\u4f5c\u89e3\u91ca\u3002 \u4f8b\u5982\uff1a\/b\/\u5339\u914d\u5b57\u7b26\u2019b\u2019, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[],"tags":[],"class_list":["post-655","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts\/655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=655"}],"version-history":[{"count":0,"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts\/655\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=655"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=655"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}