{"id":89,"date":"2023-06-05T13:09:43","date_gmt":"2023-06-05T05:09:43","guid":{"rendered":"http:\/\/pro369.com\/php\/?p=89"},"modified":"2019-04-16T16:30:22","modified_gmt":"2019-04-16T16:30:22","slug":"%e6%ad%a3%e5%89%87%e8%a1%a8%e9%81%94%e5%bc%8f%e7%9a%84%e7%a0%94%e7%a9%b6","status":"publish","type":"post","link":"https:\/\/por.tw\/php\/%e6%ad%a3%e5%89%87%e8%a1%a8%e9%81%94%e5%bc%8f%e7%9a%84%e7%a0%94%e7%a9%b6\/","title":{"rendered":"\u6b63\u5247\u8868\u9054\u5f0f\u7684\u7814\u7a76"},"content":{"rendered":"<p><strong><font color=\"#800000\">\u6b63\u5247\u8868\u9054\u5f0f\u662f\u4e00\u500b\u7121\u6bd4\u5f37\u5927\u7684\u5de5\u5177.\u4efb\u4f55\u5730\u65b9\u6211\u5011\u90fd\u53ef\u80fd\u7528\u5230\u5b83&hellip;<\/font><br \/> <font color=\"#0000FF\">\u539f\u4f86\u523b\u82e6\u7684\u5543\u904e \u6b63\u5247\u8868\u9054\u5f0f,\u4f46\u6642\u9593\u9577\u4e86\u9084\u662f\u6703\u5fd8&hellip;<\/font><br \/> <font color=\"#008000\">\u4eca\u5929\u53c8\u4f86\u6eab\u7fd2\u4e00\u4e0b..\u770b\u5230\u4e00\u7bc7\u4e0d\u932f\u7684\u6587\u7ae0..\u6240\u4ee5\u5c31\u8f49\u904e\u4f86\u6536\u85cf\u4e0b.<\/font><\/strong><\/p>\n<p> \u524d\u8a00\uff1a<br \/> \u534a\u5e74\u524d\u6211\u5c0d\u6b63\u5247\u8868\u9054\u5f0f\u7522\u751f\u4e86\u8208\u8da3\uff0c\u5728\u7db2\u4e0a\u5c0b\u627e\u904e\u4e0d\u5c11\u8cc7\u6599\uff0c\u770b\u904e\u4e0d\u5c11\u7684\u6559\u5b78\uff0c\u6700\u5f8c\u5728\u4f7f\u7528\u4e00\u500b\u6b63\u5247\u8868\u9054\u5f0f\u5de5\u5177RegexBuddy\u6642\u767c\u73fe\u4ed6\u7684\u6559\u5b78\u5beb\u7684\u975e\u5e38\u597d\uff0c\u53ef\u4ee5\u8aaa\u662f\u6211\u76ee\u524d\u898b\u904e\u6700\u597d\u7684\u6b63\u5247\u8868\u9054\u5f0f\u6559\u5b78\u3002\u65bc\u662f\u4e00\u76f4\u60f3\u628a\u4ed6\u7ffb\u8b6f\u904e\u4f86\u3002\u9019\u500b\u9858\u671b\u76f4\u5230\u9019\u500b\u4e94\u4e00\u9577\u5047\u624d\u5f97\u4ee5\u5be6\u73fe\uff0c\u7d50\u679c\u5c31\u6709\u4e86\u9019\u7bc7\u6587\u7ae0\u3002\u95dc\u65bc\u672c\u6587\u7684\u540d\u5b57\uff0c\u4f7f\u7528\u300c\u6df1\u5165\u6dfa\u51fa\u300d\u4f3c\u4e4e\u5df2\u7d93\u592a\u4fd7\u3002\u4f46\u662f\u901a\u8b80\u539f\u6587\u4ee5\u5f8c\uff0c\u89ba\u5f97\u53ea\u6709\u7528\u300c\u6df1\u5165\u6dfa\u51fa\u300d\u624d\u80fd\u6e96\u78ba\u7684\u8868\u9054\u51fa\u8a72\u6559\u5b78\u7d66\u6211\u7684\u611f\u53d7\uff0c\u6240\u4ee5\u4e5f\u5c31\u4e0d\u80fd\u514d\u4fd7\u4e86\u3002<br \/> \u672c\u6587\u662fJan Goyvaerts\u70baRegexBuddy\u5beb\u7684\u6559\u5b78\u7684\u8b6f\u6587\uff0c\u7248\u6b0a\u6b78\u539f\u4f5c\u8005\u6240\u6709\uff0c\u6b61\u8fce\u8f49\u8f09\u3002\u4f46\u662f\u70ba\u4e86\u5c0a\u91cd\u539f\u4f5c\u8005\u548c\u8b6f\u8005\u7684\u52de\u52d5\uff0c\u8acb\u8a3b\u660e\u51fa\u8655\uff01\u8b1d\u8b1d\uff01<br \/> <font color=\"#800080\"><strong><br \/> 1.\u4ec0\u9ebc\u662f\u6b63\u5247\u8868\u9054\u5f0f<\/strong><\/font><\/p>\n<p> \u57fa\u672c\u8aaa\u4f86\uff0c\u6b63\u5247\u8868\u9054\u5f0f\u662f\u4e00\u7a2e\u7528\u4f86\u63cf\u8ff0\u4e00\u5b9a\u6578\u91cf\u6587\u5b57\u7684\u6a21\u5f0f\u3002Regex\u4ee3\u8868Regular Express\u3002\u672c\u6587\u5c07\u7528&lt;&lt;regex&gt;&gt;\u4f86\u8868\u793a\u4e00\u6bb5\u5177\u9ad4\u7684\u6b63\u5247\u8868\u9054\u5f0f\u3002<\/p>\n<p> \u4e00\u6bb5\u6587\u5b57\u5c31\u662f\u6700\u57fa\u672c\u7684\u6a21\u5f0f\uff0c\u7c21\u55ae\u7684\u7b26\u5408\u76f8\u540c\u7684\u6587\u5b57\u3002<\/p>\n<p> <font color=\"#800000\"><strong>2.\u4e0d\u540c\u7684\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce<\/strong><\/font><\/p>\n<p> \u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u662f\u4e00\u7a2e\u53ef\u4ee5\u8655\u7406\u6b63\u5247\u8868\u9054\u5f0f\u7684\u8edf\u9ad4\u3002\u901a\u5e38\uff0c\u5f15\u64ce\u662f\u66f4\u5927\u7684\u61c9\u7528\u7a0b\u5f0f\u7684\u4e00\u90e8\u5206\u3002\u5728\u8edf\u9ad4\u4e16\u754c\uff0c\u4e0d\u540c\u7684\u6b63\u5247\u8868\u9054\u5f0f\u4e26\u4e0d\u4e92\u76f8\u76f8\u5bb9\u3002\u672c\u6559\u5b78\u6703\u96c6\u4e2d\u8a0e\u8ad6Perl 5 \u985e\u578b\u7684\u5f15\u64ce\uff0c\u56e0\u70ba\u9019\u7a2e\u5f15\u64ce\u662f\u61c9\u7528\u6700\u5ee3\u6cdb\u7684\u5f15\u64ce\u3002\u540c\u6642\u6211\u5011\u4e5f\u6703\u63d0\u5230\u4e00\u4e9b\u548c\u5176\u4ed6\u5f15\u64ce\u7684\u5340\u5225\u3002\u8a31\u591a\u8fd1\u4ee3\u7684\u5f15\u64ce\u90fd\u5f88\u985e\u4f3c\uff0c\u4f46\u4e0d\u5b8c\u5168\u4e00\u6a23\u3002\u4f8b\u5982.NET\u6b63\u5247\u5eab\uff0cJDK\u6b63\u5247\u5305\u3002<\/p>\n<p> <font color=\"#0000FF\"><strong>3.\u6587\u5b57\u5143\u865f<\/strong><\/font><\/p>\n<p> \u6700\u57fa\u672c\u7684\u6b63\u5247\u8868\u9054\u5f0f\u7531\u55ae\u500b\u6587\u5b57\u5143\u865f\u7d44\u6210\u3002\u5982&lt;&lt;a&gt;&gt;\uff0c\u5b83\u5c07\u7b26\u5408\u5b57\u4e32\u4e2d\u7b2c\u4e00\u6b21\u51fa\u73fe\u7684\u5b57\u5143\u300ca\u300d\u3002\u5982\u5c0d\u5b57\u4e32\u300cJack is a boy\u300d\u3002\u300cJ\u300d\u5f8c\u7684\u300ca\u300d\u5c07\u88ab\u7b26\u5408\u3002\u800c\u7b2c\u4e8c\u500b\u300ca\u300d\u5c07\u4e0d\u6703\u88ab\u7b26\u5408\u3002<\/p>\n<p> \u6b63\u5247\u8868\u9054\u5f0f\u4e5f\u53ef\u4ee5\u7b26\u5408\u7b2c\u4e8c\u500b\u300ca\u300d\uff0c\u9019\u5fc5\u9808\u662f\u4f60\u544a\u8a34\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u5f9e\u7b2c\u4e00\u6b21\u7b26\u5408\u7684\u5730\u65b9\u958b\u59cb\u641c\u5c0b\u3002\u5728\u6587\u5b57\u7de8\u8f2f\u5668\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u300c\u5c0b\u627e\u4e0b\u4e00\u500b\u300d\u3002\u5728\u5beb\u7a0b\u5f0f\u8a9e\u7cfb\u4e2d\uff0c\u6703\u6709\u4e00\u500b\u51fd\u6578\u53ef\u4ee5\u4f7f\u4f60\u5f9e\u524d\u4e00\u6b21\u7b26\u5408\u7684\u4f4d\u7f6e\u958b\u59cb\u7e7c\u7e8c\u5411\u5f8c\u641c\u5c0b\u3002<\/p>\n<p> \u985e\u4f3c\u7684\uff0c&lt;&lt;cat&gt;&gt;\u6703\u7b26\u5408\u300cAbout cats and dogs\u300d\u4e2d\u7684\u300ccat\u300d\u3002\u9019\u7b49\u65bc\u662f\u544a\u8a34\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\uff0c\u627e\u5230\u4e00\u500b&lt;&lt;c&gt;&gt;\uff0c\u7dca\u8ddf\u4e00\u500b&lt;&lt;a&gt;&gt;\uff0c\u518d\u8ddf\u4e00\u500b&lt;&lt;t&gt;&gt;\u3002<\/p>\n<p> \u8981\u6ce8\u610f\uff0c\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u9810\u8a2d\u662f\u5927\u5c0f\u5beb\u654f\u611f\u7684\u3002\u9664\u975e\u4f60\u544a\u8a34\u5f15\u64ce\u5ffd\u7565\u5927\u5c0f\u5beb\uff0c\u5426\u5247&lt;&lt;cat&gt;&gt;\u4e0d\u6703\u7b26\u5408\u300cCat\u300d\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u7279\u6b8a\u5b57\u5143<\/p>\n<p> \u5c0d\u65bc\u6587\u5b57\u5b57\u5143\uff0c\u670912\u500b\u5b57\u5143\u88ab\u4fdd\u7559\u4f5c\u7279\u6b8a\u7528\u9014\u3002\u4ed6\u5011\u662f\uff1a<\/p>\n<p> [ ]  ^ $ . | ? * + ( )<\/p>\n<p> \u9019\u4e9b\u7279\u6b8a\u5b57\u5143\u4e5f\u88ab\u7a31\u4f5c\u5143\u5b57\u5143\u3002<\/p>\n<p> \u5982\u679c\u4f60\u60f3\u5728\u6b63\u5247\u8868\u9054\u5f0f\u4e2d\u5c07\u9019\u4e9b\u5b57\u5143\u7528\u4f5c\u6587\u5b57\u5b57\u5143\uff0c\u4f60\u9700\u8981\u7528\u53cd\u659c\u69d3\u300c\u300d\u5c0d\u5176\u9032\u884c\u63db\u78bc (escape)\u3002\u4f8b\u5982\u4f60\u60f3\u7b26\u5408\u300c1+1=2\u300d\uff0c\u6b63\u78ba\u7684\u8868\u9054\u5f0f\u70ba&lt;&lt;1+1=2&gt;&gt;.<\/p>\n<p> \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c&lt;&lt;1+1=2&gt;&gt;\u4e5f\u662f\u6709\u6548\u7684\u6b63\u5247\u8868\u9054\u5f0f\u3002\u4f46\u5b83\u4e0d\u6703\u7b26\u5408\u300c1+1=2\u300d\uff0c\u800c\u6703\u7b26\u5408\u300c123+111=234\u300d\u4e2d\u7684\u300c111=2\u300d\u3002\u56e0\u70ba\u300c+\u300d\u5728\u9019\u88e1\u8868\u793a\u7279\u6b8a\u542b\u7fa9\uff08\u91cd\u89071\u6b21\u5230\u591a\u6b21\uff09\u3002<\/p>\n<p> \u5728\u5beb\u7a0b\u5f0f\u8a9e\u7cfb\u4e2d\uff0c\u8981\u6ce8\u610f\uff0c\u4e00\u4e9b\u7279\u6b8a\u7684\u5b57\u5143\u6703\u5148\u88ab\u7de8\u8b6f\u5668\u8655\u7406\uff0c\u7136\u5f8c\u518d\u50b3\u905e\u7d66\u6b63\u5247\u5f15\u64ce\u3002\u56e0\u6b64\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt;1+2=2&gt;&gt;\u5728C++\u4e2d\u8981\u5beb\u6210\u300c1+1=2\u300d\u3002\u70ba\u4e86\u7b26\u5408\u300cC:\temp\u300d\uff0c\u4f60\u8981\u7528\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt;C:\temp&gt;&gt;\u3002\u800c\u5728C++\u4e2d\uff0c\u6b63\u5247\u8868\u9054\u5f0f\u5247\u8b8a\u6210\u4e86\u300cC:\temp\u300d\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u4e0d\u53ef\u986f\u793a\u5b57\u5143<\/p>\n<p> \u53ef\u4ee5\u4f7f\u7528\u7279\u6b8a\u5b57\u5143\u5e8f\u5217\u4f86\u4ee3\u8868\u67d0\u4e9b\u4e0d\u53ef\u986f\u793a\u5b57\u5143\uff1a<\/p>\n<p> &lt;&lt;\t&gt;&gt;\u4ee3\u8868Tab(0&times;09)<\/p>\n<p> &lt;&lt;<br \/>\n&gt;&gt;\u4ee3\u8868\u63db\u884c\u7b26(0x0D)<\/p>\n<p> &lt;&lt;<br \/>\n&gt;&gt;\u4ee3\u8868\u63db\u884c\u7b26(0x0A)<\/p>\n<p> \u8981\u6ce8\u610f\u7684\u662fWindows\u4e2d\u6587\u5b57\u6a94\u6848\u4f7f\u7528\u300c<br \/>\n\u300d\u4f86\u7d50\u675f\u4e00\u884c\u800cUnix\u4f7f\u7528\u300c<br \/>\n\u300d\u3002<\/p>\n<p> <font color=\"#993366\"><strong>4.\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u7684\u5167\u5b9a\u5de5\u4f5c\u6a5f\u5236<\/strong><\/font><\/p>\n<p> \u77e5\u9053\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u662f\u5982\u4f55\u5de5\u4f5c\u7684\u6709\u52a9\u65bc\u4f60\u5f88\u5feb\u7406\u89e3\u70ba\u4f55\u67d0\u500b\u6b63\u5247\u8868\u9054\u5f0f\u4e0d\u50cf\u4f60\u671f\u671b\u7684\u90a3\u6a23\u5de5\u4f5c\u3002<\/p>\n<p> \u6709\u5169\u7a2e\u985e\u578b\u7684\u5f15\u64ce\uff1a\u6587\u5b57\u5c0e\u5411(text-directed)\u7684\u5f15\u64ce\u548c\u6b63\u5247\u5c0e\u5411(regex-directed)\u7684\u5f15\u64ce\u3002Jeffrey Friedl\u628a\u4ed6\u5011\u7a31\u4f5cDFA\u548cNFA\u5f15\u64ce\u3002\u672c\u6587\u8ac7\u5230\u7684\u662f\u6b63\u5247\u5c0e\u5411\u7684\u5f15\u64ce\u3002\u9019\u662f\u56e0\u70ba\u4e00\u4e9b\u975e\u5e38\u6709\u7528\u7684\u7279\u6027\uff0c\u5982\u300c\u60f0\u6027\u300d\u91cf\u8a5e(lazy quantifiers)\u548c\u53cd\u5411\u5f15\u7528(backreferences)\uff0c\u53ea\u80fd\u5728\u6b63\u5247\u5c0e\u5411\u7684\u5f15\u64ce\u4e2d\u5be6\u73fe\u3002\u6240\u4ee5\u6beb\u4e0d\u610f\u5916\u9019\u7a2e\u5f15\u64ce\u662f\u76ee\u524d\u6700\u6d41\u884c\u7684\u5f15\u64ce\u3002<\/p>\n<p> \u4f60\u53ef\u4ee5\u8f15\u6613\u5206\u8fa8\u51fa\u6240\u4f7f\u7528\u7684\u5f15\u64ce\u662f\u6587\u5b57\u5c0e\u5411\u9084\u662f\u6b63\u5247\u5c0e\u5411\u3002\u5982\u679c\u53cd\u5411\u5f15\u7528\u6216\u300c\u60f0\u6027\u300d\u91cf\u8a5e\u88ab\u5be6\u73fe\uff0c\u5247\u53ef\u4ee5\u80af\u5b9a\u4f60\u4f7f\u7528\u7684\u5f15\u64ce\u662f\u6b63\u5247\u5c0e\u5411\u7684\u3002\u4f60\u53ef\u4ee5\u4f5c\u5982\u4e0b\u6e2c\u8a66\uff1a\u5c07\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt;regex|regex not&gt;&gt;\u61c9\u7528\u5230\u5b57\u4e32\u300cregex not\u300d\u3002\u5982\u679c\u7b26\u5408\u7684\u7d50\u679c\u662fregex\uff0c\u5247\u5f15\u64ce\u662f\u6b63\u5247\u5c0e\u5411\u7684\u3002\u5982\u679c\u7d50\u679c\u662fregex not\uff0c\u5247\u662f\u6587\u5b57\u5c0e\u5411\u7684\u3002\u56e0\u70ba\u6b63\u5247\u5c0e\u5411\u7684\u5f15\u64ce\u662f\u300c\u7334\u6025\u300d\u7684\uff0c\u5b83\u6703\u5f88\u6025\u5207\u7684\u9032\u884c\u8868\u529f\uff0c\u5831\u544a\u5b83\u627e\u5230\u7684\u7b2c\u4e00\u500b\u7b26\u5408 \u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u6b63\u5247\u5c0e\u5411\u7684\u5f15\u64ce\u7e3d\u662f\u8fd4\u56de\u6700\u5de6\u908a\u7684\u7b26\u5408<\/p>\n<p> \u9019\u662f\u9700\u8981\u4f60\u7406\u89e3\u7684\u5f88\u91cd\u8981\u7684\u4e00\u9ede\uff1a\u5373\u4f7f\u4ee5\u5f8c\u6709\u53ef\u80fd\u767c\u73fe\u4e00\u500b\u300c\u66f4\u597d\u300d\u7684\u7b26\u5408\uff0c\u6b63\u5247\u5c0e\u5411\u7684\u5f15\u64ce\u4e5f\u7e3d\u662f\u8fd4\u56de\u6700\u5de6\u908a\u7684\u7b26\u5408\u3002<\/p>\n<p> \u7576\u628a&lt;&lt;cat&gt;&gt;\u61c9\u7528\u5230\u300cHe captured a catfish for his cat\u300d\uff0c\u5f15\u64ce\u5148\u6bd4\u8f03&lt;&lt;c&gt;&gt;\u548c\u300cH\u300d\uff0c\u7d50\u679c\u5931\u6557\u4e86\u3002\u65bc\u662f\u5f15\u64ce\u518d\u6bd4\u8f03&lt;&lt;c&gt;&gt;\u548c\u300ce\u300d\uff0c\u4e5f\u5931\u6557\u4e86\u3002\u76f4\u5230\u7b2c\u56db\u500b\u5b57\u5143\uff0c&lt;&lt;c&gt;&gt;\u7b26\u5408\u4e86\u300cc\u300d\u3002&lt;&lt;a&gt;&gt;\u7b26\u5408\u4e86\u7b2c\u4e94\u500b\u5b57\u5143\u3002\u5230\u7b2c\u516d\u500b\u5b57\u5143&lt;&lt;t&gt;&gt;\u6c92\u80fd\u7b26\u5408\u300cp\u300d\uff0c\u4e5f\u5931\u6557\u4e86\u3002\u5f15\u64ce\u518d\u7e7c\u7e8c\u5f9e\u7b2c\u4e94\u500b\u5b57\u5143\u91cd\u65b0\u6aa2\u67e5\u7b26\u5408\u6027\u3002\u76f4\u5230\u7b2c\u5341\u4e94\u500b\u5b57\u5143\u958b\u59cb\uff0c&lt;&lt;cat&gt;&gt;\u7b26\u5408\u4e0a\u4e86\u300ccatfish\u300d\u4e2d\u7684\u300ccat\u300d\uff0c\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u6025\u5207\u7684\u8fd4\u56de\u7b2c\u4e00\u500b\u7b26\u5408\u7684\u7d50\u679c\uff0c\u800c\u4e0d\u6703\u518d\u7e7c\u7e8c\u5c0b\u627e\u662f\u5426\u6709\u5176\u4ed6\u66f4\u597d\u7684\u7b26\u5408\u3002<\/p>\n<p> <font color=\"#FF0000\"><strong>5.\u5b57\u96c6<\/strong><\/font><\/p>\n<p> \u5b57\u96c6\u662f\u7531\u4e00\u5c0d\u65b9\u62ec\u865f\u300c[]\u300d\u62ec\u8d77\u4f86\u7684\u5b57\u96c6\u5408\u3002\u4f7f\u7528\u5b57\u96c6\uff0c\u4f60\u53ef\u4ee5\u544a\u8a34\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u50c5\u50c5\u7b26\u5408\u591a\u500b\u5b57\u5143\u4e2d\u7684\u4e00\u500b\u3002\u5982\u679c\u4f60\u60f3\u7b26\u5408\u4e00\u500b\u300ca\u300d\u6216\u4e00\u500b\u300ce\u300d\uff0c\u4f7f\u7528&lt;&lt;[ae]&gt;&gt;\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528&lt;&lt;gr[ae]y&gt;&gt;\u7b26\u5408gray\u6216grey\u3002\u9019\u5728\u4f60\u4e0d\u78ba\u5b9a\u4f60\u8981\u641c\u5c0b\u7684\u5b57\u5143\u662f\u63a1\u7528\u7f8e\u570b\u82f1\u8a9e\u9084\u662f\u82f1\u570b\u82f1\u8a9e\u6642\u7279\u5225\u6709\u7528\u3002\u76f8\u53cd\uff0c&lt;&lt;gr[ae]y&gt;&gt;\u5c07\u4e0d\u6703\u7b26\u5408graay\u6216graey\u3002\u5b57\u96c6\u4e2d\u7684\u5b57\u5143\u9806\u5e8f\u4e26\u6c92\u6709\u4ec0\u9ebc\u95dc\u4fc2\uff0c\u7d50\u679c\u90fd\u662f\u76f8\u540c\u7684\u3002<\/p>\n<p> \u4f60\u53ef\u4ee5\u4f7f\u7528\u9023\u5b57\u5143\u300c-\u300d\u5b9a\u7fa9\u4e00\u500b\u5b57\u5143\u7bc4\u570d\u4f5c\u70ba\u5b57\u96c6\u3002&lt;&lt;[0-9]&gt;&gt;\u7b26\u54080\u52309\u4e4b\u9593\u7684\u55ae\u500b\u6578\u5b57\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0d\u6b62\u4e00\u500b\u7bc4\u570d\u3002&lt;&lt;[0-9a-fA-F] &gt;&gt;\u7b26\u5408\u55ae\u500b\u7684\u5341\u516d\u9032\u4f4d\u6578\u5b57\uff0c\u4e26\u4e14\u5927\u5c0f\u5beb\u4e0d\u654f\u611f\u3002\u4f60\u4e5f\u53ef\u4ee5\u7d50\u5408\u7bc4\u570d\u5b9a\u7fa9\u8207\u55ae\u500b\u5b57\u5143\u5b9a\u7fa9\u3002&lt;&lt;[0-9a-fxA-FX]&gt;&gt;\u7b26\u5408\u4e00\u500b\u5341\u516d\u9032\u4f4d\u6578\u5b57\u6216\u5b57\u6bcdX\u3002\u518d\u6b21\u5f37\u8abf\u4e00\u4e0b\uff0c\u5b57\u5143\u548c\u7bc4\u570d\u5b9a\u7fa9\u7684\u5148\u5f8c\u9806\u5e8f\u5c0d\u7d50\u679c\u6c92\u6709\u5f71\u97ff\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u5b57\u96c6\u7684\u4e00\u4e9b\u61c9\u7528<\/p>\n<p> \u5c0b\u627e\u4e00\u500b\u53ef\u80fd\u6709\u62fc\u5b57\u932f\u8aa4\u7684\u55ae\u8a5e\uff0c\u6bd4\u5982&lt;&lt;sep[ae]r[ae]te&gt;&gt; \u6216 &lt;&lt;li[cs]en[cs]e&gt;&gt;\u3002<\/p>\n<p> \u5c0b\u627e\u7a0b\u5f0f\u8a9e\u7cfb\u7684\u6a19\u8b58\u7b26\uff0c&lt;&lt;A-Za-z_][A-Za-z_0-9]*&gt;&gt;\u3002(*\u8868\u793a\u91cd\u89070\u6216\u591a\u6b21)<\/p>\n<p> \u5c0b\u627eC\u98a8\u683c\u7684\u5341\u516d\u9032\u4f4d\u6578&lt;&lt;0[xX][A-Fa-f0-9]+&gt;&gt;\u3002(+\u8868\u793a\u91cd\u8907\u4e00\u6b21\u6216\u591a\u6b21)<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u53d6\u53cd\u5b57\u96c6<\/p>\n<p> \u5728\u5de6\u65b9\u62ec\u865f\u300c[\u300d\u5f8c\u9762\u7dca\u8ddf\u4e00\u500b\u5c16\u62ec\u865f\u300c^\u300d\uff0c\u5c07\u6703\u5c0d\u5b57\u96c6\u53d6\u53cd\u3002\u7d50\u679c\u662f\u5b57\u96c6\u5c07\u7b26\u5408\u4efb\u4f55\u4e0d\u5728\u65b9\u62ec\u865f\u4e2d\u7684\u5b57\u5143\u3002\u4e0d\u50cf\u300c.\u300d\uff0c\u53d6\u53cd\u5b57\u96c6\u662f\u53ef\u4ee5\u7b26\u5408\u63db\u884c\u63db\u884c\u7b26\u7684\u3002<\/p>\n<p> \u9700\u8981\u8a18\u4f4f\u7684\u5f88\u91cd\u8981\u7684\u4e00\u9ede\u662f\uff0c\u53d6\u53cd\u5b57\u96c6\u5fc5\u9808\u8981\u7b26\u5408\u4e00\u500b\u5b57\u5143\u3002&lt;&lt;q[^u]&gt;&gt;\u4e26\u4e0d\u610f\u5473\u8457\uff1a\u7b26\u5408\u4e00\u500bq\uff0c\u5f8c\u9762\u6c92\u6709u\u8ddf\u8457\u3002\u5b83\u610f\u5473\u8457\uff1a\u7b26\u5408\u4e00\u500bq\uff0c\u5f8c\u9762\u8ddf\u8457\u4e00\u500b\u4e0d\u662fu\u7684\u5b57\u5143\u3002\u6240\u4ee5\u5b83\u4e0d\u6703\u7b26\u5408\u300cIraq\u300d\u4e2d\u7684q\uff0c\u800c\u6703\u7b26\u5408\u300cIraq is a country\u300d\u4e2d\u7684q\u548c\u4e00\u500b\u7a7a\u683c\u7b26\u3002\u4e8b\u5be6\u4e0a\uff0c\u7a7a\u683c\u7b26\u662f\u7b26\u5408\u4e2d\u7684\u4e00\u90e8\u5206\uff0c\u56e0\u70ba\u5b83\u662f\u4e00\u500b\u300c\u4e0d\u662fu\u7684\u5b57\u5143\u300d\u3002<\/p>\n<p> \u5982\u679c\u4f60\u53ea\u60f3\u7b26\u5408\u4e00\u500bq\uff0c\u689d\u4ef6\u662fq\u5f8c\u9762\u6709\u4e00\u500b\u4e0d\u662fu\u7684\u5b57\u5143\uff0c\u6211\u5011\u53ef\u4ee5\u7528\u5f8c\u9762\u5c07\u8b1b\u5230\u7684\u5411\u524d\u6aa2\u8996\u4f86\u89e3\u6c7a\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u5b57\u96c6\u4e2d\u7684\u5143\u5b57\u5143<\/p>\n<p> \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u5b57\u96c6\u4e2d\u53ea\u67094\u500b \u5b57\u5143\u5177\u6709\u7279\u6b8a\u542b\u7fa9\u3002\u5b83\u5011\u662f\uff1a\u300c]  ^ -\u300d\u3002\u300c]\u300d\u4ee3\u8868\u5b57\u96c6\u5b9a\u7fa9\u7684\u7d50\u675f\uff1b\u300c\u300d\u4ee3\u8868\u8f49\u7fa9\uff1b\u300c^\u300d\u4ee3\u8868\u53d6\u53cd\uff1b\u300c-\u300d\u4ee3\u8868\u7bc4\u570d\u5b9a\u7fa9\u3002\u5176\u4ed6\u5e38\u898b\u7684\u5143\u5b57\u5143\u5728\u5b57\u96c6\u5b9a\u7fa9\u5167\u5b9a\u90fd\u662f\u6a19\u6e96\u5b57\u5143\uff0c\u4e0d\u9700\u8981\u8f49\u7fa9\u3002\u4f8b\u5982\uff0c\u8981\u641c\u5c0b\u661f\u865f*\u6216\u52a0\u865f+\uff0c\u4f60\u53ef\u4ee5\u7528&lt;&lt;[+*]&gt;&gt;\u3002\u7576\u7136\uff0c\u5982\u679c\u4f60\u5c0d\u90a3\u4e9b\u901a\u5e38\u7684\u5143\u5b57\u5143\u9032\u884c\u8f49\u7fa9\uff0c\u4f60\u7684\u6b63\u5247\u8868\u9054\u5f0f\u4e00\u6a23\u6703\u5de5\u4f5c\u5f97\u5f88\u597d\uff0c\u4f46\u662f\u9019\u6703\u964d\u4f4e\u53ef\u8b80\u6027\u3002<\/p>\n<p> \u5728\u5b57\u96c6\u5b9a\u7fa9\u4e2d\u70ba\u4e86\u5c07\u53cd\u659c\u69d3\u300c\u300d\u4f5c\u70ba\u4e00\u500b\u6587\u5b57\u5b57\u5143\u800c\u975e\u7279\u6b8a\u542b\u7fa9\u7684\u5b57\u5143\uff0c\u4f60\u9700\u8981\u7528\u53e6\u4e00\u500b\u53cd\u659c\u69d3\u5c0d\u5b83\u9032\u884c\u8f49\u7fa9\u3002&lt;&lt;[x]&gt;&gt;\u5c07\u6703\u7b26\u5408\u4e00\u500b\u53cd\u659c\u69d3\u548c\u4e00\u500bX\u3002\u300c]^-\u300d\u90fd\u53ef\u4ee5\u7528\u53cd\u659c\u69d3\u9032\u884c\u8f49\u7fa9\uff0c\u6216\u662f\u5c07\u4ed6\u5011\u653e\u5728\u4e00\u500b\u4e0d\u53ef\u80fd\u4f7f\u7528\u5230\u4ed6\u5011\u7279\u6b8a\u542b\u7fa9\u7684\u4f4d\u7f6e\u3002\u6211\u5011\u63a8\u85a6\u5f8c\u8005\uff0c\u56e0\u70ba\u9019\u6a23\u53ef\u4ee5\u589e\u52a0\u53ef\u8b80\u6027\u3002\u6bd4\u5982\u5c0d\u65bc\u5b57\u5143\u300c^\u300d\uff0c\u5c07\u5b83\u653e\u5728\u9664\u4e86\u5de6\u62ec\u865f\u300c[\u300d\u5f8c\u9762\u7684\u4f4d\u7f6e\uff0c\u4f7f\u7528\u7684\u90fd\u662f\u6587\u5b57\u5b57\u5143\u542b\u7fa9\u800c\u975e\u53d6\u53cd\u542b\u7fa9\u3002\u5982&lt;&lt;[x^]&gt;&gt;\u6703\u7b26\u5408\u4e00\u500bx\u6216^\u3002&lt;&lt;[]x]&gt;&gt;\u6703\u7b26\u5408\u4e00\u500b\u300c]\u300d\u6216\u300cx\u300d\u3002&lt;&lt;[-x]&gt;&gt;\u6216&lt;&lt;[x-]&gt;&gt;\u90fd\u6703\u7b26\u5408\u4e00\u500b\u300c-\u300d\u6216\u300cx\u300d\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u5b57\u96c6\u7684\u7c21\u5beb<\/p>\n<p> \u56e0\u70ba\u4e00\u4e9b\u5b57\u96c6\u975e\u5e38\u5e38\u7528\uff0c\u6240\u4ee5\u6709\u4e00\u4e9b\u7c21\u5beb\u6a21\u5f0f\u3002<\/p>\n<p> &lt;&lt;d&gt;&gt;\u4ee3\u8868&lt;&lt;[0-9]&gt;&gt;;<\/p>\n<p> &lt;&lt;w&gt;&gt;\u4ee3\u8868\u55ae\u8a5e\u5b57\u5143\u3002\u9019\u500b\u662f\u96a8\u6b63\u5247\u8868\u9054\u5f0f\u5be6\u73fe\u7684\u4e0d\u540c\u800c\u6709\u4e9b\u5dee\u7570\u3002\u7d55\u5927\u591a\u6578\u7684\u6b63\u5247\u8868\u9054\u5f0f\u5be6\u73fe\u7684\u55ae\u8a5e\u5b57\u96c6\u90fd\u5305\u62ec\u4e86&lt;&lt;A-Za-z0-9_]&gt;&gt;\u3002<\/p>\n<p> &lt;&lt;s&gt;&gt;\u4ee3\u8868\u300c\u767d\u5b57\u5143\u300d\u3002\u9019\u500b\u4e5f\u662f\u548c\u4e0d\u540c\u7684\u5be6\u73fe\u6709\u95dc\u7684\u3002\u5728\u7d55\u5927\u591a\u6578\u7684\u5be6\u73fe\u4e2d\uff0c\u90fd\u5305\u62ec\u4e86\u7a7a\u683c\u7b26\u548cTab\u7b26\uff0c\u4ee5\u53ca\u63db\u884c\u63db\u884c\u7b26&lt;&lt;<br \/>\n&gt;&gt;\u3002<\/p>\n<p> \u5b57\u96c6\u7684\u7e2e\u5beb\u5f62\u5f0f\u53ef\u4ee5\u7528\u5728\u65b9\u62ec\u865f\u4e4b\u5167\u6216\u4e4b\u5916\u3002&lt;&lt;sd&gt;&gt;\u7b26\u5408\u4e00\u500b\u767d\u5b57\u5143\u5f8c\u9762\u7dca\u8ddf\u4e00\u500b\u6578\u5b57\u3002&lt;&lt;[sd]&gt;&gt;\u7b26\u5408\u55ae\u500b\u767d\u5b57\u5143\u6216\u6578\u5b57\u3002&lt;&lt;[da-fA-F]&gt;&gt;\u5c07\u7b26\u5408\u4e00\u500b\u5341\u516d\u9032\u4f4d\u6578\u5b57\u3002<\/p>\n<p> \u53d6\u53cd\u5b57\u96c6\u7684\u7c21\u5beb<\/p>\n<p> &lt;&lt;[S]&gt;&gt; = &lt;&lt;[^s]&gt;&gt;<\/p>\n<p> &lt;&lt;[W]&gt;&gt; = &lt;&lt;[^w]&gt;&gt;<\/p>\n<p> &lt;&lt;[D]&gt;&gt; = &lt;&lt;[^d]&gt;&gt;<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u5b57\u96c6\u7684\u91cd\u8907<\/p>\n<p> \u5982\u679c\u4f60\u7528\u300c?*+\u300d\u64cd\u4f5c\u7b26\u4f86\u91cd\u8907\u4e00\u500b\u5b57\u96c6\uff0c\u4f60\u5c07\u6703\u91cd\u8907\u6574\u500b\u5b57\u96c6\u3002\u800c\u4e0d\u50c5\u662f\u5b83\u7b26\u5408\u7684\u90a3\u500b\u5b57\u5143\u3002\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt;[0-9]+&gt;&gt;\u6703\u7b26\u5408837\u4ee5\u53ca222\u3002<\/p>\n<p> \u5982\u679c\u4f60\u50c5\u50c5\u60f3\u91cd\u8907\u88ab\u7b26\u5408\u7684\u90a3\u500b\u5b57\u5143\uff0c\u53ef\u4ee5\u7528\u5411\u5f8c\u5f15\u7528\u9054\u5230\u76ee\u7684\u3002\u6211\u5011\u4ee5\u5f8c\u5c07\u8b1b\u5230\u5411\u5f8c\u5f15\u7528\u3002<\/p>\n<p> <font color=\"#008000\"><strong>6.\u4f7f\u7528?*\u6216+ \u9032\u884c\u91cd\u8907<\/strong><\/font><\/p>\n<p> ?\uff1a\u544a\u8a34\u5f15\u64ce\u7b26\u5408\u524d\u5c0e\u5b57\u51430\u6b21\u6216\u4e00\u6b21\u3002\u4e8b\u5be6\u4e0a\u662f\u8868\u793a\u524d\u5c0e\u5b57\u5143\u662f\u53ef\u9078\u7684\u3002<\/p>\n<p> +\uff1a\u544a\u8a34\u5f15\u64ce\u7b26\u5408\u524d\u5c0e\u5b57\u51431\u6b21\u6216\u591a\u6b21<\/p>\n<p> *\uff1a\u544a\u8a34\u5f15\u64ce\u7b26\u5408\u524d\u5c0e\u5b57\u51430\u6b21\u6216\u591a\u6b21<\/p>\n<p> &lt;[A-Za-z][A-Za-z0-9]*&gt;\u7b26\u5408\u6c92\u6709\u5c6c\u6027\u7684HTML\u6a19\u7c64\uff0c\u300c&lt;\u300d\u4ee5\u53ca\u300c&gt;\u300d\u662f\u6587\u5b57\u5143\u865f\u3002\u7b2c\u4e00\u500b\u5b57\u96c6\u7b26\u5408\u4e00\u500b\u5b57\u6bcd\uff0c\u7b2c\u4e8c\u500b\u5b57\u96c6\u7b26\u5408\u4e00\u500b\u5b57\u6bcd\u6216\u6578\u5b57\u3002<\/p>\n<p> \u6211\u5011\u4f3c\u4e4e\u4e5f\u53ef\u4ee5\u7528&lt;[A-Za-z0-9]+&gt;\u3002\u4f46\u662f\u5b83\u6703\u7b26\u5408&lt;1&gt;\u3002\u4f46\u662f\u9019\u500b\u6b63\u5247\u8868\u9054\u5f0f\u5728\u4f60\u77e5\u9053\u4f60\u8981\u641c\u5c0b\u7684\u5b57\u4e32\u4e0d\u5305\u62ec\u985e\u4f3c\u7684\u7121\u6548\u6a19\u7c64\u6642\u9084\u662f\u8db3\u5920\u6709\u6548\u7684\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u9650\u5236\u6027\u91cd\u8907<\/p>\n<p> \u8a31\u591a\u73fe\u4ee3\u7684\u6b63\u5247\u8868\u9054\u5f0f\u5be6\u73fe\uff0c\u90fd\u5bb9\u8a31\u4f60\u5b9a\u7fa9\u5c0d\u4e00\u500b\u5b57\u5143\u91cd\u8907\u591a\u5c11\u6b21\u3002\u8a5e\u6cd5\u662f\uff1a{min,max}\u3002min\u548cmax\u90fd\u662f\u975e\u8ca0\u6574\u6578\u3002\u5982\u679c\u9017\u865f\u6709\u800cmax\u88ab\u5ffd\u7565\u4e86\uff0c\u5247max\u6c92\u6709\u9650\u5236\u3002\u5982\u679c\u9017\u865f\u548cmax\u90fd\u88ab\u5ffd\u7565\u4e86\uff0c\u5247\u91cd\u8907min\u6b21\u3002<\/p>\n<p> \u56e0\u6b64{0,}\u548c*\u4e00\u6a23\uff0c{1\uff0c}\u548c+ \u7684\u4f5c\u7528\u4e00\u6a23\u3002<\/p>\n<p> \u4f60\u53ef\u4ee5\u7528&lt;&lt;\b[1-9][0-9]{3}\b&gt;&gt;\u7b26\u54081000~9999\u4e4b\u9593\u7684\u6578\u5b57(\u300c\b\u300d\u8868\u793a\u55ae\u8a5e\u908a\u754c)\u3002&lt;&lt;\b[1-9][0-9]{2,4}\b&gt;&gt;\u7b26\u5408\u4e00\u500b\u5728100~99999\u4e4b\u9593\u7684\u6578\u5b57\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u6ce8\u610f\u8caa\u5a6a\u6027<\/p>\n<p> \u5047\u8a2d\u4f60\u60f3\u7528\u4e00\u500b\u6b63\u5247\u8868\u9054\u5f0f\u7b26\u5408\u4e00\u500bHTML\u6a19\u7c64\u3002\u4f60\u77e5\u9053\u8f38\u5165\u5c07\u6703\u662f\u4e00\u500b\u6709\u6548\u7684HTML\u6a94\u6848\uff0c\u56e0\u6b64\u6b63\u5247\u8868\u9054\u5f0f\u4e0d\u9700\u8981\u6392\u9664\u90a3\u4e9b\u7121\u6548\u7684\u6a19\u7c64\u3002\u6240\u4ee5\u5982\u679c\u662f\u5728\u5169\u500b\u5c16\u62ec\u865f\u4e4b\u9593\u7684\u5167\u5bb9\uff0c\u5c31\u61c9\u8a72\u662f\u4e00\u500bHTML\u6a19\u7c64\u3002<\/p>\n<p> \u8a31\u591a\u6b63\u5247\u8868\u9054\u5f0f\u7684\u65b0\u624b\u6703\u9996\u5148\u60f3\u5230\u7528\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt; &lt;.+&gt; &gt;&gt;\uff0c\u4ed6\u5011\u6703\u5f88\u9a5a\u8a1d\u7684\u767c\u73fe\uff0c\u5c0d\u65bc\u6e2c\u8a66\u5b57\u4e32\uff0c\u300cThis is a &lt;EM&gt;first&lt;\/EM&gt; test\u300d\uff0c\u4f60\u53ef\u80fd\u671f\u671b\u6703\u8fd4\u56de&lt;EM&gt;\uff0c\u7136\u5f8c\u7e7c\u7e8c\u9032\u884c\u7b26\u5408\u7684\u6642\u5019\uff0c\u8fd4\u56de&lt;\/EM&gt;\u3002<\/p>\n<p> \u4f46\u4e8b\u5be6\u662f\u4e0d\u6703\u3002\u6b63\u5247\u8868\u9054\u5f0f\u5c07\u6703\u7b26\u5408\u300c&lt;EM&gt;first&lt;\/EM&gt;\u300d\u3002\u5f88\u986f\u7136\u9019\u4e0d\u662f\u6211\u5011\u60f3\u8981\u7684\u7d50\u679c\u3002\u539f\u56e0\u5728\u65bc\u300c+\u300d\u662f\u8caa\u5a6a\u7684\u3002\u4e5f\u5c31\u662f\u8aaa\uff0c\u300c+\u300d\u6703\u5c0e\u81f4\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u8a66\u5716\u76e1\u53ef\u80fd\u7684\u91cd\u8907\u524d\u5c0e\u5b57\u5143\u3002\u53ea\u6709\u7576\u9019\u7a2e\u91cd\u8907\u6703\u5f15\u8d77\u6574\u500b\u6b63\u5247\u8868\u9054\u5f0f\u7b26\u5408\u5931\u6557\u7684\u60c5\u6cc1\u4e0b\uff0c\u5f15\u64ce\u6703\u9032\u884c\u56de\u6eaf\u3002\u4e5f\u5c31\u662f\u8aaa\uff0c\u5b83\u6703\u653e\u68c4\u6700\u5f8c\u4e00\u6b21\u7684\u300c\u91cd\u8907\u300d\uff0c\u7136\u5f8c\u8655\u7406\u6b63\u5247\u8868\u9054\u5f0f\u9918\u4e0b\u7684\u90e8\u5206\u3002<\/p>\n<p> \u548c\u300c+\u300d\u985e\u4f3c\uff0c\u300c?*\u300d\u7684\u91cd\u8907\u4e5f\u662f\u8caa\u5a6a\u7684\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u6df1\u5165\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u5167\u5b9a<\/p>\n<p> \u8b93\u6211\u5011\u4f86\u770b\u770b\u6b63\u5247\u5f15\u64ce\u5982\u4f55\u7b26\u5408\u524d\u9762\u7684\u4f8b\u5b50\u3002\u7b2c\u4e00\u500b\u8a18\u865f\u662f\u300c&lt;\u300d\uff0c\u9019\u662f\u4e00\u500b\u6587\u5b57\u5143\u865f\u3002\u7b2c\u4e8c\u500b\u7b26\u865f\u662f\u300c.\u300d\uff0c\u7b26\u5408\u4e86\u5b57\u5143\u300cE\u300d\uff0c\u7136\u5f8c\u300c+\u300d\u4e00\u76f4\u53ef\u4ee5\u7b26\u5408\u5176\u9918\u7684\u5b57\u5143\uff0c\u76f4\u5230\u4e00\u884c\u7684\u7d50\u675f\u3002\u7136\u5f8c\u5230\u4e86\u63db\u884c\u7b26\uff0c\u7b26\u5408\u5931\u6557(\u300c.\u300d\u4e0d\u7b26\u5408\u63db\u884c\u7b26)\u3002\u65bc\u662f\u5f15\u64ce\u958b\u59cb\u5c0d\u4e0b\u4e00\u500b\u6b63\u5247\u8868\u9054\u5f0f\u7b26\u865f\u9032\u884c\u7b26\u5408\u3002\u4e5f\u5373\u8a66\u5716\u7b26\u5408\u300c&gt;\u300d\u3002\u5230\u76ee\u524d\u70ba\u6b62\uff0c\u300c&lt;.+\u300d\u5df2\u7d93\u7b26\u5408\u4e86\u300c&lt;EM&gt;first&lt;\/EM&gt; test\u300d\u3002\u5f15\u64ce\u6703\u8a66\u5716\u5c07\u300c&gt;\u300d\u8207\u63db\u884c\u7b26\u9032\u884c\u7b26\u5408\uff0c\u7d50\u679c\u5931\u6557\u4e86\u3002\u65bc\u662f\u5f15\u64ce\u9032\u884c\u56de\u6eaf\u3002\u7d50\u679c\u662f\u73fe\u5728\u300c&lt;.+\u300d\u7b26\u5408\u300c&lt;EM&gt;first&lt;\/EM&gt; tes\u300d\u3002\u65bc\u662f\u5f15\u64ce\u5c07\u300c&gt;\u300d\u8207\u300ct\u300d\u9032\u884c\u7b26\u5408\u3002\u986f\u7136\u9084\u662f\u6703\u5931\u6557\u3002\u9019\u500b\u904e\u7a0b\u7e7c\u7e8c\uff0c\u76f4\u5230\u300c&lt;.+\u300d\u7b26\u5408\u300c&lt;EM&gt;first&lt;\/EM\u300d\uff0c\u300c&gt;\u300d\u8207\u300c&gt;\u300d\u7b26\u5408\u3002\u65bc\u662f\u5f15\u64ce\u627e\u5230\u4e86\u4e00\u500b\u7b26\u5408\u300c&lt;EM&gt;first&lt;\/EM&gt;\u300d\u3002\u8a18\u4f4f\uff0c\u6b63\u5247\u5c0e\u5411\u7684\u5f15\u64ce\u662f\u300c\u6025\u5207\u7684\u300d\uff0c\u6240\u4ee5\u5b83\u6703\u6025\u8457\u5831\u544a\u5b83\u627e\u5230\u7684\u7b2c\u4e00\u500b\u7b26\u5408\u3002\u800c\u4e0d\u662f\u7e7c\u7e8c\u56de\u6eaf\uff0c\u5373\u4f7f\u53ef\u80fd\u6703\u6709\u66f4\u597d\u7684\u7b26\u5408\uff0c\u4f8b\u5982\u300c&lt;EM&gt;\u300d\u3002\u6240\u4ee5\u6211\u5011\u53ef\u4ee5\u770b\u5230\uff0c\u7531\u65bc\u300c+\u300d\u7684\u8caa\u5a6a\u6027\uff0c\u4f7f\u5f97\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u8fd4\u56de\u4e86\u4e00\u500b\u6700\u5de6\u908a\u7684\u6700\u9577\u7684\u7b26\u5408\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u7528\u61f6\u60f0\u6027\u53d6\u4ee3\u8caa\u5a6a\u6027<\/p>\n<p> \u4e00\u500b\u7528\u65bc\u4fee\u6b63\u4ee5\u4e0a\u554f\u984c\u7684\u53ef\u80fd\u5c08\u6848\u662f\u7528\u300c+\u300d\u7684\u60f0\u6027\u4ee3\u66ff\u8caa\u5a6a\u6027\u3002\u4f60\u53ef\u4ee5\u5728\u300c+\u300d\u5f8c\u9762\u7dca\u8ddf\u4e00\u500b\u554f\u865f\u300c?\u300d\u4f86\u9054\u5230\u9019\u4e00\u9ede\u3002\u300c*\u300d\uff0c\u300c{}\u300d\u548c\u300c?\u300d\u8868\u793a\u7684\u91cd\u8907\u4e5f\u53ef\u4ee5\u7528\u9019\u500b\u5c08\u6848\u3002\u56e0\u6b64\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\u6211\u5011\u53ef\u4ee5\u4f7f\u7528\u300c&lt;.+?&gt;\u300d\u3002\u8b93\u6211\u5011\u518d\u4f86\u770b\u770b\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u7684\u8655\u7406\u904e\u7a0b\u3002<\/p>\n<p> \u518d\u4e00\u6b21\uff0c\u6b63\u5247\u8868\u9054\u5f0f\u8a18\u865f\u300c&lt;\u300d\u6703\u7b26\u5408\u5b57\u4e32\u7684\u7b2c\u4e00\u500b\u300c&lt;\u300d\u3002\u4e0b\u4e00\u500b\u6b63\u5247\u8a18\u865f\u662f\u300c.\u300d\u3002\u9019\u6b21\u662f\u4e00\u500b\u61f6\u60f0\u7684\u300c+\u300d\u4f86\u91cd\u8907\u4e0a\u4e00\u500b\u5b57\u5143\u3002\u9019\u544a\u8a34\u6b63\u5247\u5f15\u64ce\uff0c\u76e1\u53ef\u80fd\u5c11\u7684\u91cd\u8907\u4e0a\u4e00\u500b\u5b57\u5143\u3002\u56e0\u6b64\u5f15\u64ce\u7b26\u5408\u300c.\u300d\u548c\u5b57\u5143\u300cE\u300d\uff0c\u7136\u5f8c\u7528\u300c&gt;\u300d\u7b26\u5408\u300cM\u300d\uff0c\u7d50\u679c\u5931\u6557\u4e86\u3002\u5f15\u64ce\u6703\u9032\u884c\u56de\u6eaf\uff0c\u548c\u4e0a\u4e00\u500b\u4f8b\u5b50\u4e0d\u540c\uff0c\u56e0\u70ba\u662f\u60f0\u6027\u91cd\u8907\uff0c\u6240\u4ee5\u5f15\u64ce\u662f\u5ef6\u4f38\u60f0\u6027\u91cd\u8907\u800c\u4e0d\u662f\u6e1b\u5c11\uff0c\u65bc\u662f\u300c&lt;.+\u300d\u73fe\u5728\u88ab\u5ef6\u4f38\u70ba\u300c&lt;EM\u300d\u3002\u5f15\u64ce\u7e7c\u7e8c\u7b26\u5408\u4e0b\u4e00\u500b\u8a18\u865f\u300c&gt;\u300d\u3002\u9019\u6b21\u5f97\u5230\u4e86\u4e00\u500b\u5b8c\u6210\u7b26\u5408\u3002\u5f15\u64ce\u65bc\u662f\u5831\u544a\u300c&lt;EM&gt;\u300d\u662f\u4e00\u500b\u5b8c\u6210\u7684\u7b26\u5408\u3002\u6574\u500b\u904e\u7a0b\u5927\u81f4\u5982\u6b64\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u60f0\u6027\u5ef6\u4f38\u7684\u4e00\u500b\u66ff\u4ee3\u5c08\u6848<\/p>\n<p> \u6211\u5011\u9084\u6709\u4e00\u500b\u66f4\u597d\u7684\u66ff\u4ee3\u5c08\u6848\u3002\u53ef\u4ee5\u7528\u4e00\u500b\u8caa\u5a6a\u91cd\u8907\u8207\u4e00\u500b\u53d6\u53cd\u5b57\u96c6\uff1a\u300c&lt;[^&gt;]+&gt;\u300d\u3002\u4e4b\u6240\u4ee5\u8aaa\u9019\u662f\u4e00\u500b\u66f4\u597d\u7684\u5c08\u6848\u5728\u65bc\u4f7f\u7528\u60f0\u6027\u91cd\u8907\u6642\uff0c\u5f15\u64ce\u6703\u5728\u627e\u5230\u4e00\u500b\u5b8c\u6210\u7b26\u5408\u524d\u5c0d\u6bcf\u4e00\u500b\u5b57\u5143\u9032\u884c\u56de\u6eaf\u3002\u800c\u4f7f\u7528\u53d6\u53cd\u5b57\u96c6\u5247\u4e0d\u9700\u8981\u9032\u884c\u56de\u6eaf\u3002<\/p>\n<p> \u6700\u5f8c\u8981\u8a18\u4f4f\u7684\u662f\uff0c\u672c\u6559\u5b78\u50c5\u50c5\u8ac7\u5230\u7684\u662f\u6b63\u5247\u5c0e\u5411\u7684\u5f15\u64ce\u3002\u6587\u5b57\u5c0e\u5411\u7684\u5f15\u64ce\u662f\u4e0d\u56de\u6eaf\u7684\u3002\u4f46\u662f\u540c\u6642\u4ed6\u5011\u4e5f\u4e0d\u652f\u63f4\u60f0\u6027\u91cd\u8907\u64cd\u4f5c\u3002<\/p>\n<p> <font color=\"#0000FF\"><strong>7.\u4f7f\u7528\u300c.\u300d\u7b26\u5408\u5e7e\u4e4e\u4efb\u610f\u5b57\u5143<\/strong><\/font><\/p>\n<p> \u5728\u6b63\u5247\u8868\u9054\u5f0f\u4e2d\uff0c\u300c.\u300d\u662f\u6700\u5e38\u7528\u7684\u7b26\u865f\u4e4b\u4e00\u3002\u4e0d\u5e78\u7684\u662f\uff0c\u5b83\u4e5f\u662f\u6700\u5bb9\u6613\u88ab\u8aa4\u7528\u7684\u7b26\u865f\u4e4b\u4e00\u3002<\/p>\n<p> \u300c.\u300d\u7b26\u5408\u4e00\u500b\u55ae\u500b\u7684\u5b57\u5143\u800c\u4e0d\u7528\u95dc\u5fc3\u88ab\u7b26\u5408\u7684\u5b57\u5143\u662f\u4ec0\u9ebc\u3002\u552f\u4e00\u7684\u4f8b\u5916\u662f\u65b0\u884c\u7b26\u3002\u5728\u672c\u6559\u5b78\u4e2d\u8ac7\u5230\u7684\u5f15\u64ce\uff0c\u9810\u8a2d\u60c5\u6cc1\u4e0b\u90fd\u662f\u4e0d\u7b26\u5408\u65b0\u884c\u7b26\u7684\u3002\u56e0\u6b64\u5728\u9810\u8a2d\u60c5\u6cc1\u4e0b\uff0c\u300c.\u300d\u7b49\u65bc\u662f\u5b57\u96c6[^<\/p>\n<p>](Window)\u6216[^<br \/>\n]( Unix)\u7684\u7c21\u5beb\u3002<\/p>\n<p> \u9019\u500b\u4f8b\u5916\u662f\u56e0\u70ba\u6b77\u53f2\u7684\u539f\u56e0\u3002\u56e0\u70ba\u65e9\u671f\u4f7f\u7528\u6b63\u5247\u8868\u9054\u5f0f\u7684\u5de5\u5177\u662f\u57fa\u65bc\u884c\u7684\u3002\u5b83\u5011\u90fd\u662f\u4e00\u884c\u4e00\u884c\u7684\u8b80\u5165\u4e00\u500b\u6a94\u6848\uff0c\u5c07\u6b63\u5247\u8868\u9054\u5f0f\u5206\u5225\u61c9\u7528\u5230\u6bcf\u4e00\u884c\u4e0a\u53bb\u3002\u5728\u9019\u4e9b\u5de5\u5177\u4e2d\uff0c\u5b57\u4e32\u662f\u4e0d\u5305\u62ec\u65b0\u884c\u7b26\u7684\u3002\u56e0\u6b64\u300c.\u300d\u4e5f\u5c31\u6c38\u9060\u4e0d\u7b26\u5408\u65b0\u884c\u7b26\u3002<\/p>\n<p> \u73fe\u4ee3\u7684\u5de5\u5177\u548c\u8a9e\u7cfb\u80fd\u5920\u5c07\u6b63\u5247\u8868\u9054\u5f0f\u61c9\u7528\u5230\u5f88\u5927\u7684\u5b57\u4e32\u751a\u81f3\u6574\u500b\u6a94\u6848\u4e0a\u53bb\u3002\u672c\u6559\u5b78\u8a0e\u8ad6\u7684\u6240\u6709\u6b63\u5247\u8868\u9054\u5f0f\u5be6\u73fe\u90fd\u63d0\u4f9b\u4e00\u500b\u9078\u9805\uff0c\u53ef\u4ee5\u4f7f\u300c.\u300d\u7b26\u5408\u6240\u6709\u7684\u5b57\u5143\uff0c\u5167\u542b\u65b0\u884c\u7b26\u3002\u5728RegexBuddy, EditPad Pro\u6216PowerGREP\u7b49\u5de5\u5177\u4e2d\uff0c\u4f60\u53ef\u4ee5\u7c21\u55ae\u7684\u9078\u4e2d\u300c\u9ede\u865f\u7b26\u5408\u65b0\u884c\u7b26\u300d\u3002\u5728Perl\u4e2d\uff0c\u300c.\u300d\u53ef\u4ee5\u7b26\u5408\u65b0\u884c\u7b26\u7684\u6a21\u5f0f\u88ab\u7a31\u4f5c\u300c\u55ae\u884c\u6a21\u5f0f\u300d\u3002\u5f88\u4e0d\u5e78\uff0c\u9019\u662f\u4e00\u500b\u5f88\u5bb9\u6613\u6df7\u6dc6\u7684\u540d\u8a5e\u3002\u56e0\u70ba\u9084\u6709\u6240\u8b02\u300c\u591a\u884c\u6a21\u5f0f\u300d\u3002\u591a\u884c\u6a21\u5f0f\u53ea\u5f71\u97ff\u884c\u9996\u884c\u5c3e\u7684\u9328\u5b9a(anchor)\uff0c\u800c\u55ae\u884c\u6a21\u5f0f\u53ea\u5f71\u97ff\u300c.\u300d\u3002<\/p>\n<p> \u5176\u4ed6\u8a9e\u7cfb\u548c\u6b63\u5247\u8868\u9054\u5f0f\u5eab\u4e5f\u63a1\u7528\u4e86Perl\u7684\u8853\u8a9e\u5b9a\u7fa9\u3002\u7576\u5728.NET Framework\u4e2d\u4f7f\u7528\u6b63\u5247\u8868\u9054\u5f0f\u985e\u6642\uff0c\u4f60\u53ef\u4ee5\u7528\u985e\u4f3c\u4e0b\u9762\u7684\u8a9e\u53e5\u4f86\u555f\u52d5\u55ae\u884c\u6a21\u5f0f\uff1aRegex.Match(\u300cstring\u300d,\u300dregex\u300d,RegexOptions.SingleLine)<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u4fdd\u5b88\u7684\u4f7f\u7528\u9ede\u865f\u300c.\u300d<\/p>\n<p> \u9ede\u865f\u53ef\u4ee5\u8aaa\u662f\u6700\u5f37\u5927\u7684\u5143\u5b57\u5143\u3002\u5b83\u5bb9\u8a31\u4f60\u5077\u61f6\uff1a\u7528\u4e00\u500b\u9ede\u865f\uff0c\u5c31\u80fd\u7b26\u5408\u5e7e\u4e4e\u6240\u6709\u7684\u5b57\u5143\u3002\u4f46\u662f\u554f\u984c\u5728\u65bc\uff0c\u5b83\u4e5f\u5e38\u5e38\u6703\u7b26\u5408\u4e0d\u8a72\u7b26\u5408\u7684\u5b57\u5143\u3002<\/p>\n<p> \u6211\u6703\u4ee5\u4e00\u500b\u7c21\u55ae\u7684\u4f8b\u5b50\u4f86\u8aaa\u660e\u3002\u8b93\u6211\u5011\u770b\u770b\u5982\u4f55\u7b26\u5408\u4e00\u500b\u5177\u6709\u300cmm\/dd\/yy\u300d\u683c\u5f0f\u7684\u65e5\u671f\uff0c\u4f46\u662f\u6211\u5011\u60f3\u5bb9\u8a31\u4f7f\u7528\u8005\u4f86\u9078\u53d6\u5206\u9694\u8a2d\u5b9a\u3002\u5f88\u5feb\u80fd\u60f3\u5230\u7684\u4e00\u500b\u5c08\u6848\u662f&lt;&lt;dd.dd.dd&gt;&gt;\u3002\u770b\u4e0a\u53bb\u5b83\u80fd\u7b26\u5408\u65e5\u671f\u300c02\/12\/03\u300d\u3002\u554f\u984c\u5728\u65bc02512703\u4e5f\u6703\u88ab\u8a8d\u70ba\u662f\u4e00\u500b\u6709\u6548\u7684\u65e5\u671f\u3002<\/p>\n<p> &lt;&lt;dd[-\/.]dd[-\/.]dd&gt;&gt;\u770b\u4e0a\u53bb\u662f\u4e00\u500b\u597d\u4e00\u9ede\u7684\u89e3\u6c7a\u5c08\u6848\u3002\u8a18\u4f4f\u9ede\u865f\u5728\u4e00\u500b\u5b57\u96c6\u88e1\u4e0d\u662f\u5143\u5b57\u5143\u3002\u9019\u500b\u5c08\u6848\u9060\u4e0d\u5920\u5b8c\u5584\uff0c\u5b83\u6703\u7b26\u5408\u300c99\/99\/99\u300d\u3002\u800c&lt;&lt;[0-1]d[-\/.][0-3]d[-\/.]dd&gt;&gt;\u53c8\u66f4\u9032\u4e00\u6b65\u3002\u5118\u7ba1\u4ed6\u4e5f\u6703\u7b26\u5408\u300c19\/39\/99\u300d\u3002\u4f60\u60f3\u8981\u4f60\u7684\u6b63\u5247\u8868\u9054\u5f0f\u9054\u5230\u5982\u4f55\u5b8c\u7f8e\u7684\u7a0b\u5ea6\u53d6\u6c7a\u65bc\u4f60\u60f3\u9054\u5230\u4ec0\u9ebc\u6a23\u7684\u76ee\u7684\u3002\u5982\u679c\u4f60\u60f3\u6821\u9a57\u4f7f\u7528\u8005\u8f38\u5165\uff0c\u5247\u9700\u8981\u76e1\u53ef\u80fd\u7684\u5b8c\u7f8e\u3002\u5982\u679c\u4f60\u53ea\u662f\u60f3\u5206\u6790\u4e00\u500b\u5df2\u77e5\u7684\u6e90\uff0c\u4e26\u4e14\u6211\u5011\u77e5\u9053\u6c92\u6709\u932f\u8aa4\u7684\u8cc7\u6599\uff0c\u7528\u4e00\u500b\u6bd4\u8f03\u597d\u7684\u6b63\u5247\u8868\u9054\u5f0f\u4f86\u7b26\u5408\u4f60\u60f3\u8981\u641c\u5c0b\u7684\u5b57\u5143\u5c31\u5df2\u7d93\u8db3\u5920\u3002<\/p>\n<p> &nbsp;<\/p>\n<p> 8.\u5b57\u4e32\u958b\u59cb\u548c\u7d50\u675f\u7684\u9328\u5b9a<\/p>\n<p> \u9328\u5b9a\u548c\u4e00\u822c\u7684\u6b63\u5247\u8868\u9054\u5f0f\u7b26\u865f\u4e0d\u540c\uff0c\u5b83\u4e0d\u7b26\u5408\u4efb\u4f55\u5b57\u5143\u3002\u76f8\u53cd\uff0c\u4ed6\u5011\u7b26\u5408\u7684\u662f\u5b57\u5143\u4e4b\u524d\u6216\u4e4b\u5f8c\u7684\u4f4d\u7f6e\u3002\u300c^\u300d\u7b26\u5408\u4e00\u884c\u5b57\u4e32\u7b2c\u4e00\u500b\u5b57\u5143\u524d\u7684\u4f4d\u7f6e\u3002&lt;&lt;^a&gt;&gt;\u5c07\u6703\u7b26\u5408\u5b57\u4e32\u300cabc\u300d\u4e2d\u7684a\u3002&lt;&lt;^b&gt;&gt;\u5c07\u4e0d\u6703\u7b26\u5408\u300cabc\u300d\u4e2d\u7684\u4efb\u4f55\u5b57\u5143\u3002<\/p>\n<p> \u985e\u4f3c\u7684\uff0c$\u7b26\u5408\u5b57\u4e32\u4e2d\u6700\u5f8c\u4e00\u500b\u5b57\u5143\u7684\u5f8c\u9762\u7684\u4f4d\u7f6e\u3002\u6240\u4ee5&lt;&lt;c$&gt;&gt;\u7b26\u5408\u300cabc\u300d\u4e2d\u7684c\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u9328\u5b9a\u7684\u61c9\u7528<\/p>\n<p> \u5728\u5beb\u7a0b\u5f0f\u8a9e\u7cfb\u4e2d\u6821\u9a57\u4f7f\u7528\u8005\u8f38\u5165\u6642\uff0c\u4f7f\u7528\u9328\u5b9a\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u5982\u679c\u4f60\u60f3\u6821\u9a57\u4f7f\u7528\u8005\u7684\u8f38\u5165\u70ba\u6574\u6578\uff0c\u7528&lt;&lt;^d+$&gt;&gt;\u3002<\/p>\n<p> \u4f7f\u7528\u8005\u8f38\u5165\u4e2d\uff0c\u5e38\u5e38\u6703\u6709\u591a\u9918\u7684\u524d\u5c0e\u7a7a\u683c\u6216\u7d50\u675f\u7a7a\u683c\u3002\u4f60\u53ef\u4ee5\u7528&lt;&lt;^s*&gt;&gt;\u548c&lt;&lt;s*$&gt;&gt;\u4f86\u7b26\u5408\u524d\u5c0e\u7a7a\u683c\u6216\u7d50\u675f\u7a7a\u683c\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u4f7f\u7528\u300c^\u300d\u548c\u300c$\u300d\u4f5c\u70ba\u884c\u7684\u958b\u59cb\u548c\u7d50\u675f\u9328\u5b9a<\/p>\n<p> \u5982\u679c\u4f60\u6709\u4e00\u500b\u5305\u62ec\u4e86\u591a\u884c\u7684\u5b57\u4e32\u3002\u4f8b\u5982\uff1a\u300cfirst line<\/p>\n<p>second line\u300d(\u5176\u4e2d<\/p>\n<p>\u8868\u793a\u4e00\u500b\u65b0\u884c\u7b26)\u3002\u5e38\u5e38\u9700\u8981\u5c0d\u6bcf\u884c\u5206\u5225\u8655\u7406\u800c\u4e0d\u662f\u6574\u500b\u5b57\u4e32\u3002\u56e0\u6b64\uff0c\u5e7e\u4e4e\u6240\u6709\u7684\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u90fd\u63d0\u4f9b\u4e00\u500b\u9078\u9805\uff0c\u53ef\u4ee5\u5ef6\u4f38\u9019\u5169\u7a2e\u9328\u5b9a\u7684\u542b\u7fa9\u3002\u300c^\u300d\u53ef\u4ee5\u7b26\u5408\u5b57\u4e32\u7684\u958b\u59cb\u4f4d\u7f6e(\u5728f\u4e4b\u524d)\uff0c\u4ee5\u53ca\u6bcf\u4e00\u500b\u65b0\u884c\u7b26\u7684\u5f8c\u9762\u4f4d\u7f6e(\u5728<\/p>\n<p>\u548cs\u4e4b\u9593)\u3002\u985e\u4f3c\u7684\uff0c$\u6703\u7b26\u5408\u5b57\u4e32\u7684\u7d50\u675f\u4f4d\u7f6e(\u6700\u5f8c\u4e00\u500be\u4e4b\u5f8c)\uff0c\u4ee5\u53ca\u6bcf\u500b\u65b0\u884c\u7b26\u7684\u524d\u9762(\u5728e\u8207<\/p>\n<p>\u4e4b\u9593)\u3002<\/p>\n<p> \u5728.NET\u4e2d\uff0c\u7576\u4f60\u4f7f\u7528\u5982\u4e0b\u4ee3\u78bc\u6642\uff0c\u5c07\u6703\u5b9a\u7fa9\u9328\u5b9a\u7b26\u5408\u6bcf\u4e00\u500b\u65b0\u884c\u7b26\u7684\u524d\u9762\u548c\u5f8c\u9762\u4f4d\u7f6e\uff1aRegex.Match(\u300cstring\u300d, \u300cregex\u300d, RegexOptions.Multiline)<\/p>\n<p> \u61c9\u7528\uff1astring str = Regex.Replace(Original, \u300c^\u300d, \u300c&gt; \u300c, RegexOptions.Multiline)&ndash;\u5c07\u6703\u5728\u6bcf\u884c\u7684\u884c\u9996\u63d2\u5165\u300c&gt; \u300d\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u7d55\u5c0d\u9328\u5b9a<\/p>\n<p> &lt;&lt;A&gt;&gt;\u53ea\u7b26\u5408\u6574\u500b\u5b57\u4e32\u7684\u958b\u59cb\u4f4d\u7f6e\uff0c&lt;&lt;\u001a&gt;&gt;\u53ea\u7b26\u5408\u6574\u500b\u5b57\u4e32\u7684\u7d50\u675f\u4f4d\u7f6e\u3002\u5373\u4f7f\u4f60\u4f7f\u7528\u4e86\u300c\u591a\u884c\u6a21\u5f0f\u300d\uff0c&lt;&lt;A&gt;&gt;\u548c&lt;&lt;\u001a&gt;&gt;\u4e5f\u6c38\u9060\u4e0d\u7b26\u5408\u65b0\u884c\u7b26\u3002<\/p>\n<p> \u5373\u4f7f\u001a\u548c$\u53ea\u7b26\u5408\u5b57\u4e32\u7684\u7d50\u675f\u4f4d\u7f6e\uff0c\u4ecd\u7136\u6709\u4e00\u500b\u4f8b\u5916\u7684\u60c5\u6cc1\u3002\u5982\u679c\u5b57\u4e32\u4ee5\u65b0\u884c\u7b26\u7d50\u675f\uff0c\u5247\u001a\u548c$\u5c07\u6703\u7b26\u5408\u65b0\u884c\u7b26\u524d\u9762\u7684\u4f4d\u7f6e\uff0c\u800c\u4e0d\u662f\u6574\u500b\u5b57\u4e32\u7684\u6700\u5f8c\u9762\u3002\u9019\u500b\u300c\u6539\u9032\u300d\u662f\u7531Perl\u5f15\u9032\u7684\uff0c\u7136\u5f8c\u88ab\u8a31\u591a\u7684\u6b63\u5247\u8868\u9054\u5f0f\u5be6\u73fe\u6240\u9075\u5faa\uff0c\u5167\u542bJava\uff0c.NET\u7b49\u3002\u5982\u679c\u61c9\u7528&lt;&lt;^[a-z]+$&gt;&gt;\u5230\u300cjoe<br \/>\n\u300d\uff0c\u5247\u7b26\u5408\u7d50\u679c\u662f\u300cjoe\u300d\u800c\u4e0d\u662f\u300cjoe<br \/>\n\u300d\u3002<\/p>\n<p> 9.\u55ae\u8a5e\u908a\u754c<\/p>\n<p> \u5143\u5b57\u5143&lt;&lt;\b&gt;&gt;\u4e5f\u662f\u4e00\u7a2e\u5c0d\u4f4d\u7f6e\u9032\u884c\u7b26\u5408\u7684\u300c\u9328\u300d\u3002\u9019\u7a2e\u7b26\u5408\u662f0\u9577\u5ea6\u7b26\u5408\u3002<\/p>\n<p> \u67094\u7a2e\u4f4d\u7f6e\u88ab\u8a8d\u70ba\u662f\u300c\u55ae\u8a5e\u908a\u754c\u300d\uff1a<\/p>\n<p> 1)&nbsp; \u5728\u5b57\u4e32\u7684\u7b2c\u4e00\u500b\u5b57\u5143\u524d\u7684\u4f4d\u7f6e(\u5982\u679c\u5b57\u4e32\u7684\u7b2c\u4e00\u500b\u5b57\u5143\u662f\u4e00\u500b\u300c\u55ae\u8a5e\u5b57\u5143\u300d)<\/p>\n<p> 2)&nbsp; \u5728\u5b57\u4e32\u7684\u6700\u5f8c\u4e00\u500b\u5b57\u5143\u5f8c\u7684\u4f4d\u7f6e(\u5982\u679c\u5b57\u4e32\u7684\u6700\u5f8c\u4e00\u500b\u5b57\u5143\u662f\u4e00\u500b\u300c\u55ae\u8a5e\u5b57\u5143\u300d)<\/p>\n<p> 3)&nbsp; \u5728\u4e00\u500b\u300c\u55ae\u8a5e\u5b57\u5143\u300d\u548c\u300c\u975e\u55ae\u8a5e\u5b57\u5143\u300d\u4e4b\u9593\uff0c\u5176\u4e2d\u300c\u975e\u55ae\u8a5e\u5b57\u5143\u300d\u7dca\u8ddf\u5728\u300c\u55ae\u8a5e\u5b57\u5143\u300d\u4e4b\u5f8c<\/p>\n<p> 4)&nbsp; \u5728\u4e00\u500b\u300c\u975e\u55ae\u8a5e\u5b57\u5143\u300d\u548c\u300c\u55ae\u8a5e\u5b57\u5143\u300d\u4e4b\u9593\uff0c\u5176\u4e2d\u300c\u55ae\u8a5e\u5b57\u5143\u300d\u7dca\u8ddf\u5728\u300c\u975e\u55ae\u8a5e\u5b57\u5143\u300d\u5f8c\u9762<\/p>\n<p> \u300c\u55ae\u8a5e\u5b57\u5143\u300d\u662f\u53ef\u4ee5\u7528\u300cw\u300d\u7b26\u5408\u7684\u5b57\u5143\uff0c\u300c\u975e\u55ae\u8a5e\u5b57\u5143\u300d\u662f\u53ef\u4ee5\u7528\u300cW\u300d\u7b26\u5408\u7684\u5b57\u5143\u3002\u5728\u5927\u591a\u6578\u7684\u6b63\u5247\u8868\u9054\u5f0f\u5be6\u73fe\u4e2d\uff0c\u300c\u55ae\u8a5e\u5b57\u5143\u300d\u901a\u5e38\u5167\u542b&lt;&lt;[a-zA-Z0-9_]&gt;&gt;\u3002<\/p>\n<p> \u4f8b\u5982\uff1a&lt;&lt;\b4\b&gt;&gt;\u80fd\u5920\u7b26\u5408\u55ae\u500b\u76844\u800c\u4e0d\u662f\u4e00\u500b\u66f4\u5927\u6578\u7684\u4e00\u90e8\u5206\u3002\u9019\u500b\u6b63\u5247\u8868\u9054\u5f0f\u4e0d\u6703\u7b26\u5408\u300c44\u300d\u4e2d\u76844\u3002<\/p>\n<p> \u63db\u7a2e\u8aaa\u6cd5\uff0c\u5e7e\u4e4e\u53ef\u4ee5\u8aaa&lt;&lt;\b&gt;&gt;\u7b26\u5408\u4e00\u500b\u300c\u5b57\u6bcd\u6578\u5b57\u5e8f\u5217\u300d\u7684\u958b\u59cb\u548c\u7d50\u675f\u7684\u4f4d\u7f6e\u3002<\/p>\n<p> \u300c\u55ae\u8a5e\u908a\u754c\u300d\u7684\u53d6\u53cd\u96c6\u70ba&lt;&lt;B&gt;&gt;\uff0c\u4ed6\u8981\u7b26\u5408\u7684\u4f4d\u7f6e\u662f\u5169\u500b\u300c\u55ae\u8a5e\u5b57\u5143\u300d\u4e4b\u9593\u6216\u662f\u5169\u500b\u300c\u975e\u55ae\u8a5e\u5b57\u5143\u300d\u4e4b\u9593\u7684\u4f4d\u7f6e\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u6df1\u5165\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u5167\u5b9a<\/p>\n<p> \u8b93\u6211\u5011\u770b\u770b\u628a\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt;\bis\b&gt;&gt;\u61c9\u7528\u5230\u5b57\u4e32\u300cThis island is beautiful\u300d\u3002\u5f15\u64ce\u5148\u8655\u7406\u7b26\u865f&lt;&lt;\b&gt;&gt;\u3002\u56e0\u70ba\b\u662f0\u9577\u5ea6 \uff0c\u6240\u4ee5\u7b2c\u4e00\u500b\u5b57\u5143T\u524d\u9762\u7684\u4f4d\u7f6e\u6703\u88ab\u8003\u5bdf\u3002\u56e0\u70baT\u662f\u4e00\u500b\u300c\u55ae\u8a5e\u5b57\u5143\u300d\uff0c\u800c\u5b83\u524d\u9762\u7684\u5b57\u5143\u662f\u4e00\u500b\u7a7a\u5b57\u5143(void)\uff0c\u6240\u4ee5\b\u7b26\u5408\u4e86\u55ae\u8a5e\u908a\u754c\u3002\u63a5\u8457&lt;&lt;i&gt;&gt;\u548c\u7b2c\u4e00\u500b\u5b57\u5143\u300cT\u300d\u7b26\u5408\u5931\u6557\u3002\u7b26\u5408\u904e\u7a0b\u7e7c\u7e8c\u9032\u884c\uff0c\u76f4\u5230\u7b2c\u4e94\u500b\u7a7a\u683c\u7b26\uff0c\u548c\u7b2c\u56db\u500b\u5b57\u5143\u300cs\u300d\u4e4b\u9593\u53c8\u7b26\u5408\u4e86&lt;&lt;\b&gt;&gt;\u3002\u7136\u800c\u7a7a\u683c\u7b26\u548c&lt;&lt;i&gt;&gt;\u4e0d\u7b26\u5408\u3002\u7e7c\u7e8c\u5411\u5f8c\uff0c\u5230\u4e86\u7b2c\u516d\u500b\u5b57\u5143\u300ci\u300d\uff0c\u548c\u7b2c\u4e94\u500b\u7a7a\u683c\u5b57\u5143\u4e4b\u9593\u7b26\u5408\u4e86&lt;&lt;\b&gt;&gt;\uff0c\u7136\u5f8c&lt;&lt;is&gt;&gt;\u548c\u7b2c\u516d\u3001\u7b2c\u4e03\u500b\u5b57\u5143\u90fd\u7b26\u5408\u4e86\u3002\u7136\u800c\u7b2c\u516b\u500b\u5b57\u5143\u548c\u7b2c\u4e8c\u500b\u300c\u55ae\u8a5e\u908a\u754c\u300d\u4e0d\u7b26\u5408\uff0c\u6240\u4ee5\u7b26\u5408\u53c8\u5931\u6557\u4e86\u3002\u5230\u4e86\u7b2c13\u500b\u5b57\u5143i\uff0c\u56e0\u70ba\u548c\u524d\u9762\u4e00\u500b\u7a7a\u683c\u7b26\u5f62\u6210\u300c\u55ae\u8a5e\u908a\u754c\u300d\uff0c\u540c\u6642&lt;&lt;is&gt;&gt;\u548c\u300cis\u300d\u7b26\u5408\u3002\u5f15\u64ce\u63a5\u8457\u5617\u8a66\u7b26\u5408\u7b2c\u4e8c\u500b&lt;&lt;\b&gt;&gt;\u3002\u56e0\u70ba\u7b2c15\u500b\u7a7a\u683c\u7b26\u548c\u300cs\u300d\u5f62\u6210\u55ae\u8a5e\u908a\u754c\uff0c\u6240\u4ee5\u7b26\u5408\u5b8c\u6210\u3002\u5f15\u64ce\u300c\u6025\u8457\u300d\u8fd4\u56de\u5b8c\u6210\u7b26\u5408\u7684\u7d50\u679c\u3002<\/p>\n<p> <font color=\"#800000\"><strong>10.&nbsp; \u9078\u53d6\u7b26<\/strong><\/font><\/p>\n<p> \u6b63\u5247\u8868\u9054\u5f0f\u4e2d\u300c|\u300d\u8868\u793a\u9078\u53d6\u3002\u4f60\u53ef\u4ee5\u7528\u9078\u53d6\u7b26\u7b26\u5408\u591a\u500b\u53ef\u80fd\u7684\u6b63\u5247\u8868\u9054\u5f0f\u4e2d\u7684\u4e00\u500b\u3002<\/p>\n<p> \u5982\u679c\u4f60\u60f3\u641c\u5c0b\u6587\u5b57\u300ccat\u300d\u6216\u300cdog\u300d\uff0c\u4f60\u53ef\u4ee5\u7528&lt;&lt;cat|dog&gt;&gt;\u3002\u5982\u679c\u4f60\u60f3\u6709\u66f4\u591a\u7684\u9078\u53d6\uff0c\u4f60\u53ea\u8981\u5ef6\u4f38\u6e05\u55ae&lt;&lt;cat|dog|mouse|fish&gt;&gt;\u3002<\/p>\n<p> \u9078\u53d6\u7b26\u5728\u6b63\u5247\u8868\u9054\u5f0f\u4e2d\u5177\u6709\u6700\u4f4e\u7684\u512a\u5148\u7d1a\uff0c\u4e5f\u5c31\u662f\u8aaa\uff0c\u5b83\u544a\u8a34\u5f15\u64ce\u8981\u9ebc\u7b26\u5408\u9078\u53d6\u7b26\u5de6\u908a\u7684\u6240\u6709\u8868\u9054\u5f0f\uff0c\u8981\u9ebc\u7b26\u5408\u53f3\u908a\u7684\u6240\u6709\u8868\u9054\u5f0f\u3002\u4f60\u4e5f\u53ef\u4ee5\u7528\u5713\u62ec\u865f\u4f86\u9650\u5236\u9078\u53d6\u7b26\u7684\u4f5c\u7528\u7bc4\u570d\u3002\u5982&lt;&lt;\b(cat|dog)\b&gt;&gt;\uff0c\u9019\u6a23\u544a\u8a34\u6b63\u5247\u5f15\u64ce\u628a(cat|dog)\u7576\u6210\u4e00\u500b\u6b63\u5247\u8868\u9054\u5f0f\u55ae\u4f4d\u4f86\u8655\u7406\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u6ce8\u610f\u6b63\u5247\u5f15\u64ce\u7684\u300c\u6025\u65bc\u8868\u529f\u300d\u6027<\/p>\n<p> \u6b63\u5247\u5f15\u64ce\u662f\u6025\u5207\u7684\uff0c\u7576\u5b83\u627e\u5230\u4e00\u500b\u6709\u6548\u7684\u7b26\u5408\u6642\uff0c\u5b83\u6703\u505c\u6b62\u641c\u5c0b\u3002\u56e0\u6b64\u5728\u4e00\u5b9a\u689d\u4ef6\u4e0b\uff0c\u9078\u53d6\u7b26\u5169\u908a\u7684\u8868\u9054\u5f0f\u7684\u9806\u5e8f\u5c0d\u7d50\u679c\u6703\u6709\u5f71\u97ff\u3002\u5047\u8a2d\u4f60\u60f3\u7528\u6b63\u5247\u8868\u9054\u5f0f\u641c\u5c0b\u4e00\u500b\u5beb\u7a0b\u5f0f\u8a9e\u7cfb\u7684\u51fd\u6578\u6e05\u55ae\uff1aGet\uff0cGetValue\uff0cSet\u6216SetValue\u3002\u4e00\u500b\u660e\u986f\u7684\u89e3\u6c7a\u5c08\u6848\u662f&lt;&lt;Get|GetValue|Set|SetValue&gt;&gt;\u3002\u8b93\u6211\u5011\u770b\u770b\u7576\u641c\u5c0bSetValue\u6642\u7684\u7d50\u679c\u3002<\/p>\n<p> \u56e0\u70ba&lt;&lt;Get&gt;&gt;\u548c&lt;&lt;GetValue&gt;&gt;\u90fd\u5931\u6557\u4e86\uff0c\u800c&lt;&lt;Set&gt;&gt;\u7b26\u5408\u5b8c\u6210\u3002\u56e0\u70ba\u6b63\u5247\u5c0e\u5411\u7684\u5f15\u64ce\u90fd\u662f\u300c\u6025\u5207\u300d\u7684\uff0c\u6240\u4ee5\u5b83\u6703\u8fd4\u56de\u7b2c\u4e00\u500b\u5b8c\u6210\u7684\u7b26\u5408\uff0c\u5c31\u662f\u300cSet\u300d\uff0c\u800c\u4e0d\u53bb\u7e7c\u7e8c\u641c\u5c0b\u662f\u5426\u6709\u5176\u4ed6\u66f4\u597d\u7684\u7b26\u5408\u3002<\/p>\n<p> \u548c\u6211\u5011\u671f\u671b\u7684\u76f8\u53cd\uff0c\u6b63\u5247\u8868\u9054\u5f0f\u4e26\u6c92\u6709\u7b26\u5408\u6574\u500b\u5b57\u4e32\u3002\u6709\u5e7e\u7a2e\u53ef\u80fd\u7684\u89e3\u6c7a\u8fa6\u6cd5\u3002\u4e00\u662f\u8003\u616e\u5230\u6b63\u5247\u5f15\u64ce\u7684\u300c\u6025\u5207\u300d\u6027\uff0c\u6539\u8b8a\u9078\u9805\u7684\u9806\u5e8f\uff0c\u4f8b\u5982\u6211\u5011\u4f7f\u7528&lt;&lt;GetValue|Get|SetValue|Set&gt;&gt;\uff0c\u9019\u6a23\u6211\u5011\u5c31\u53ef\u4ee5\u512a\u5148\u641c\u5c0b\u6700\u9577\u7684\u7b26\u5408\u3002\u6211\u5011\u4e5f\u53ef\u4ee5\u628a\u56db\u500b\u9078\u9805\u7d50\u5408\u8d77\u4f86\u6210\u5169\u500b\u9078\u9805\uff1a&lt;&lt;Get(Value)?|Set(Value)?&gt;&gt;\u3002\u56e0\u70ba\u554f\u865f\u91cd\u8907\u7b26\u662f\u8caa\u5a6a\u7684\uff0c\u6240\u4ee5SetValue\u7e3d\u6703\u5728Set\u4e4b\u524d\u88ab\u7b26\u5408\u3002<\/p>\n<p> \u4e00\u500b\u66f4\u597d\u7684\u5c08\u6848\u662f\u4f7f\u7528\u55ae\u8a5e\u908a\u754c\uff1a&lt;&lt;\b(Get|GetValue|Set|SetValue)\b&gt;&gt;\u6216&lt;&lt;\b(Get(Value)?|Set(Value)?\b&gt;&gt;\u3002\u66f4\u9032\u4e00\u6b65\uff0c\u65e2\u7136\u6240\u6709\u7684\u9078\u53d6\u90fd\u6709\u76f8\u540c\u7684\u7d50\u5c3e\uff0c\u6211\u5011\u53ef\u4ee5\u628a\u6b63\u5247\u8868\u9054\u5f0f\u6539\u5584\u70ba&lt;&lt;\b(Get|Set)(Value)?\b&gt;&gt;\u3002<\/p>\n<p> <font color=\"#FF0000\"><strong>11.&nbsp; \u7d44\u8207\u5411\u5f8c\u5f15\u7528<\/strong><\/font><\/p>\n<p> \u628a\u6b63\u5247\u8868\u9054\u5f0f\u7684\u4e00\u90e8\u5206\u653e\u5728\u5713\u62ec\u865f\u5167\uff0c\u4f60\u53ef\u4ee5\u5c07\u5b83\u5011\u5f62\u6210\u7d44\u3002\u7136\u5f8c\u4f60\u53ef\u4ee5\u5c0d\u6574\u500b\u7d44\u4f7f\u7528\u4e00\u4e9b\u6b63\u5247\u64cd\u4f5c\uff0c\u4f8b\u5982\u91cd\u8907\u64cd\u4f5c\u7b26\u3002<\/p>\n<p> \u8981\u6ce8\u610f\u7684\u662f\uff0c\u53ea\u6709\u5713\u62ec\u865f\u300c()\u300d\u624d\u80fd\u7528\u65bc\u5f62\u6210\u7d44\u3002\u300c[]\u300d\u7528\u65bc\u5b9a\u7fa9\u5b57\u96c6\u3002\u300c{}\u300d\u7528\u65bc\u5b9a\u7fa9\u91cd\u8907\u64cd\u4f5c\u3002<\/p>\n<p> \u7576\u7528\u300c()\u300d\u5b9a\u7fa9\u4e86\u4e00\u500b\u6b63\u5247\u8868\u9054\u5f0f\u7d44\u5f8c\uff0c\u6b63\u5247\u5f15\u64ce\u5247\u6703\u628a\u88ab\u7b26\u5408\u7684\u7d44\u6309\u7167\u9806\u5e8f\u7de8\u865f\uff0c\u5b58\u5165\u5feb\u53d6\u3002\u7576\u5c0d\u88ab\u7b26\u5408\u7684\u7d44\u9032\u884c\u5411\u5f8c\u5f15\u7528\u7684\u6642\u5019\uff0c\u53ef\u4ee5\u7528\u300c\u6578\u5b57\u300d\u7684\u6a21\u5f0f\u9032\u884c\u5f15\u7528\u3002&lt;&lt;1&gt;&gt;\u5f15\u7528\u7b2c\u4e00\u500b\u7b26\u5408\u7684\u5f8c\u5411\u5f15\u7528\u7d44\uff0c&lt;&lt;2&gt;&gt;\u5f15\u7528\u7b2c\u4e8c\u500b\u7d44\uff0c\u4ee5\u6b64\u985e\u63a8\uff0c&lt;&lt;<br \/>\n&gt;&gt;\u5f15\u7528\u7b2cn\u500b\u7d44\u3002\u800c&lt;&lt; &gt;&gt;\u5247\u5f15\u7528\u6574\u500b\u88ab\u7b26\u5408\u7684\u6b63\u5247\u8868\u9054\u5f0f\u672c\u8eab\u3002\u6211\u5011\u770b\u4e00\u500b\u4f8b\u5b50\u3002<\/p>\n<p> \u5047\u8a2d\u4f60\u60f3\u7b26\u5408\u4e00\u500bHTML\u6a19\u7c64\u7684\u958b\u59cb\u6a19\u7c64\u548c\u7d50\u675f\u6a19\u7c64\uff0c\u4ee5\u53ca\u6a19\u7c64\u4e2d\u9593\u7684\u6587\u5b57\u3002\u6bd4\u5982&lt;B&gt;This is a test&lt;\/B&gt;\uff0c\u6211\u5011\u8981\u7b26\u5408&lt;B&gt;\u548c&lt;\/B&gt;\u4ee5\u53ca\u4e2d\u9593\u7684\u6587\u5b57\u3002\u6211\u5011\u53ef\u4ee5\u7528\u5982\u4e0b\u6b63\u5247\u8868\u9054\u5f0f\uff1a\u300c&lt;([A-Z][A-Z0-9]*)[^&gt;]*&gt;.*?&lt;\/1&gt;\u300d<\/p>\n<p> \u9996\u5148\uff0c\u300c&lt;\u300d\u5c07\u6703\u7b26\u5408\u300c&lt;B&gt;\u300d\u7684\u7b2c\u4e00\u500b\u5b57\u5143\u300c&lt;\u300d\u3002\u7136\u5f8c[A-Z]\u7b26\u5408B\uff0c[A-Z0-9]*\u5c07\u6703\u7b26\u54080\u5230\u591a\u6b21\u5b57\u6bcd\u6578\u5b57\uff0c\u5f8c\u9762\u7dca\u63a5\u84570\u5230\u591a\u500b\u975e\u300c&gt;\u300d\u7684\u5b57\u5143\u3002\u6700\u5f8c\u6b63\u5247\u8868\u9054\u5f0f\u7684\u300c&gt;\u300d\u5c07\u6703\u7b26\u5408\u300c&lt;B&gt;\u300d\u7684\u300c&gt;\u300d\u3002\u63a5\u4e0b\u4f86\u6b63\u5247\u5f15\u64ce\u5c07\u5c0d\u7d50\u675f\u6a19\u7c64\u4e4b\u524d\u7684\u5b57\u5143\u9032\u884c\u60f0\u6027\u7b26\u5408\uff0c\u76f4\u5230\u9047\u5230\u4e00\u500b\u300c&lt;\/\u300d\u7b26\u865f\u3002\u7136\u5f8c\u6b63\u5247\u8868\u9054\u5f0f\u4e2d\u7684\u300c1\u300d\u8868\u793a\u5c0d\u524d\u9762\u7b26\u5408\u7684\u7d44\u300c([A-Z][A-Z0-9]*)\u300d\u9032\u884c\u5f15\u7528\uff0c\u5728\u672c\u4f8b\u4e2d\uff0c\u88ab\u5f15\u7528\u7684\u662f\u6a19\u7c64\u540d\u300cB\u300d\u3002\u6240\u4ee5\u9700\u8981\u88ab\u7b26\u5408\u7684\u7d50\u5c3e\u6a19\u7c64\u70ba\u300c&lt;\/B&gt;\u300d<\/p>\n<p> \u4f60\u53ef\u4ee5\u5c0d\u76f8\u540c\u7684\u5f8c\u5411\u5f15\u7528\u7d44\u9032\u884c\u591a\u6b21\u5f15\u7528\uff0c&lt;&lt;([a-c])x1x1&gt;&gt;\u5c07\u7b26\u5408\u300caxaxa\u300d\u3001\u300cbxbxb\u300d\u4ee5\u53ca\u300ccxcxc\u300d\u3002\u5982\u679c\u7528\u6578\u5b57\u5f62\u5f0f\u5f15\u7528\u7684\u7d44\u6c92\u6709\u6709\u6548\u7684\u7b26\u5408\uff0c\u5247\u5f15\u7528\u5230\u7684\u5167\u5bb9\u7c21\u55ae\u7684\u70ba\u7a7a\u3002<\/p>\n<p> \u4e00\u500b\u5f8c\u5411\u5f15\u7528\u4e0d\u80fd\u7528\u65bc\u5b83\u81ea\u8eab\u3002&lt;&lt;([abc]1)&gt;&gt;\u662f\u932f\u8aa4\u7684\u3002\u56e0\u6b64\u4f60\u4e0d\u80fd\u5c07&lt;&lt; &gt;&gt;\u7528\u65bc\u4e00\u500b\u6b63\u5247\u8868\u9054\u5f0f\u7b26\u5408\u672c\u8eab\uff0c\u5b83\u53ea\u80fd\u7528\u65bc\u7f6e\u63db\u64cd\u4f5c\u4e2d\u3002<\/p>\n<p> \u5f8c\u5411\u5f15\u7528\u4e0d\u80fd\u7528\u65bc\u5b57\u96c6\u5167\u5b9a\u3002&lt;&lt;(a)[1b]&gt;&gt;\u4e2d\u7684&lt;&lt;1&gt;&gt;\u4e26\u4e0d\u8868\u793a\u5f8c\u5411\u5f15\u7528\u3002\u5728\u5b57\u96c6\u5167\u5b9a\uff0c&lt;&lt;1&gt;&gt;\u53ef\u4ee5\u88ab\u89e3\u91cb\u70ba\u516b\u9032\u4f4d\u5f62\u5f0f\u7684\u8f49\u78bc\u3002<\/p>\n<p> \u5411\u5f8c\u5f15\u7528\u6703\u964d\u4f4e\u5f15\u64ce\u7684\u901f\u5ea6\uff0c\u56e0\u70ba\u5b83\u9700\u8981\u5b58\u5132\u7b26\u5408\u7684\u7d44\u3002\u5982\u679c\u4f60\u4e0d\u9700\u8981\u5411\u5f8c\u5f15\u7528\uff0c\u4f60\u53ef\u4ee5\u544a\u8a34\u5f15\u64ce\u5c0d\u67d0\u500b\u7d44\u4e0d\u5b58\u5132\u3002\u4f8b\u5982\uff1a&lt;&lt;Get(?:Value)&gt;&gt;\u3002\u5176\u4e2d\u300c(\u300d\u5f8c\u9762\u7dca\u8ddf\u7684\u300c?:\u300d\u6703\u544a\u8a34\u5f15\u64ce\u5c0d\u65bc\u7d44(Value)\uff0c\u4e0d\u5b58\u5132\u7b26\u5408\u7684\u503c\u4ee5\u4f9b\u5f8c\u5411\u5f15\u7528\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u91cd\u8907\u64cd\u4f5c\u8207\u5f8c\u5411\u5f15\u7528<\/p>\n<p> \u7576\u5c0d\u7d44\u4f7f\u7528\u91cd\u8907\u64cd\u4f5c\u7b26\u6642\uff0c\u5feb\u53d6\u88e1\u5f8c\u5411\u5f15\u7528\u5167\u5bb9\u6703\u88ab\u4e0d\u65b7\u91cd\u6574\uff0c\u53ea\u4fdd\u7559\u6700\u5f8c\u7b26\u5408\u7684\u5167\u5bb9\u3002\u4f8b\u5982\uff1a&lt;&lt;([abc]+)=1&gt;&gt;\u5c07\u7b26\u5408\u300ccab=cab\u300d\uff0c\u4f46\u662f&lt;&lt;([abc])+=1&gt;&gt;\u537b\u4e0d\u6703\u3002\u56e0\u70ba([abc])\u7b2c\u4e00\u6b21\u7b26\u5408\u300cc\u300d\u6642\uff0c\u300c1\u300d\u4ee3\u8868\u300cc\u300d\uff1b\u7136\u5f8c([abc])\u6703\u7e7c\u7e8c\u7b26\u5408\u300ca\u300d\u548c\u300cb\u300d\u3002\u6700\u5f8c\u300c1\u300d\u4ee3\u8868\u300cb\u300d\uff0c\u6240\u4ee5\u5b83\u6703\u7b26\u5408\u300ccab=b\u300d\u3002<\/p>\n<p> \u61c9\u7528\uff1a\u6aa2\u67e5\u91cd\u8907\u55ae\u8a5e&ndash;\u7576\u7de8\u8f2f\u6587\u5b57\u6642\uff0c\u5f88\u5bb9\u6613\u5c31\u6703\u8f38\u5165\u91cd\u8907\u55ae\u8a5e\uff0c\u4f8b\u5982\u300cthe the\u300d\u3002\u4f7f\u7528&lt;&lt;\b(w+)s+1\b&gt;&gt;\u53ef\u4ee5\u6aa2\u9a57\u5230\u9019\u4e9b\u91cd\u8907\u55ae\u8a5e\u3002\u8981\u522a\u9664\u7b2c\u4e8c\u500b\u55ae\u8a5e\uff0c\u53ea\u8981\u7c21\u55ae\u7684\u5229\u7528\u7f6e\u63db\u529f\u80fd\u7f6e\u63db\u6389\u300c1\u300d\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u7d44\u7684\u547d\u540d\u548c\u5f15\u7528<\/p>\n<p> \u5728PHP\uff0cPython\u4e2d\uff0c\u53ef\u4ee5\u7528&lt;&lt;(?P&lt;name&gt;group)&gt;&gt;\u4f86\u5c0d\u7d44\u9032\u884c\u547d\u540d\u3002\u5728\u672c\u4f8b\u4e2d\uff0c\u8a5e\u6cd5?P&lt;name&gt;\u5c31\u662f\u5c0d\u7d44(group)\u9032\u884c\u4e86\u547d\u540d\u3002\u5176\u4e2dname\u662f\u4f60\u5c0d\u7d44\u7684\u8d77\u7684\u540d\u5b57\u3002\u4f60\u53ef\u4ee5\u7528(?P=name)\u9032\u884c\u5f15\u7528\u3002<\/p>\n<p> .NET\u7684\u547d\u540d\u7d44<\/p>\n<p> .NET framework\u4e5f\u652f\u63f4\u547d\u540d\u7d44\u3002\u4e0d\u5e78\u7684\u662f\uff0c\u5fae\u8edf\u7684\u7a0b\u5f0f\u54e1\u5011\u6c7a\u5b9a\u767c\u660e\u4ed6\u5011\u81ea\u5df1\u7684\u8a9e\u6cd5\uff0c\u800c\u4e0d\u662f\u6cbf\u7528Perl\u3001Python\u7684\u898f\u5247\u3002\u76ee\u524d\u70ba\u6b62\uff0c\u9084\u6c92\u6709\u4efb\u4f55\u5176\u4ed6\u7684\u6b63\u5247\u8868\u9054\u5f0f\u5be6\u73fe\u652f\u63f4\u5fae\u8edf\u767c\u660e\u7684\u8a9e\u6cd5\u3002<\/p>\n<p> \u4e0b\u9762\u662f.NET\u4e2d\u7684\u4f8b\u5b50\uff1a<\/p>\n<p> (?&lt;first&gt;group)(?\u300fsecond\u300fgroup)<\/p>\n<p> \u6b63\u5982\u4f60\u6240\u770b\u5230\u7684\uff0c.NET\u63d0\u4f9b\u5169\u7a2e\u8a5e\u6cd5\u4f86\u5efa\u7acb\u547d\u540d\u7d44\uff1a\u4e00\u662f\u7528\u5c16\u62ec\u865f\u300c&lt;&gt;\u300d\uff0c\u6216\u662f\u7528\u55ae\u5f15\u865f\u300c\u300f\u300f\u300d\u3002\u5c16\u62ec\u865f\u5728\u5b57\u4e32\u4e2d\u4f7f\u7528\u66f4\u65b9\u4fbf\uff0c\u55ae\u5f15\u865f\u5728ASP\u4ee3\u78bc\u4e2d\u66f4\u6709\u7528\uff0c\u56e0\u70baASP\u4ee3\u78bc\u4e2d\u300c&lt;&gt;\u300d\u88ab\u7528\u4f5cHTML\u6a19\u7c64\u3002<\/p>\n<p> \u8981\u5f15\u7528\u4e00\u500b\u547d\u540d\u7d44\uff0c\u4f7f\u7528k&lt;name&gt;\u6216k\u300fname\u300f.<\/p>\n<p> \u7576\u9032\u884c\u641c\u5c0b\u7f6e\u63db\u6642\uff0c\u4f60\u53ef\u4ee5\u7528\u300c${name}\u300d\u4f86\u5f15\u7528\u4e00\u500b\u547d\u540d\u7d44\u3002<\/p>\n<p> 12.&nbsp; \u6b63\u5247\u8868\u9054\u5f0f\u7684\u7b26\u5408\u6a21\u5f0f<\/p>\n<p> \u672c\u6559\u5b78\u6240\u8a0e\u8ad6\u7684\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u90fd\u652f\u63f4\u4e09\u7a2e\u7b26\u5408\u6a21\u5f0f\uff1a<\/p>\n<p> &lt;&lt;\/i&gt;&gt;\u4f7f\u6b63\u5247\u8868\u9054\u5f0f\u5c0d\u5927\u5c0f\u5beb\u4e0d\u654f\u611f\uff0c<\/p>\n<p> &lt;&lt;\/s&gt;&gt;\u958b\u555f\u300c\u55ae\u884c\u6a21\u5f0f\u300d\uff0c\u5373\u9ede\u865f\u300c.\u300d\u7b26\u5408\u65b0\u884c\u7b26<\/p>\n<p> &lt;&lt;\/m&gt;&gt;\u958b\u555f\u300c\u591a\u884c\u6a21\u5f0f\u300d\uff0c\u5373\u300c^\u300d\u548c\u300c$\u300d\u7b26\u5408\u65b0\u884c\u7b26\u7684\u524d\u9762\u548c\u5f8c\u9762\u7684\u4f4d\u7f6e\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u5728\u6b63\u5247\u8868\u9054\u5f0f\u5167\u5b9a\u958b\u555f\u6216\u95dc\u9589\u6a21\u5f0f<\/p>\n<p> \u5982\u679c\u4f60\u5728\u6b63\u5247\u8868\u9054\u5f0f\u5167\u5b9a\u63d2\u5165\u4fee\u98fe\u7b26(?ism)\uff0c\u5247\u8a72\u4fee\u98fe\u7b26\u53ea\u5c0d\u5176\u53f3\u908a\u7684\u6b63\u5247\u8868\u9054\u5f0f\u8d77\u4f5c\u7528\u3002(?-i)\u662f\u95dc\u9589\u5927\u5c0f\u5beb\u4e0d\u654f\u611f\u3002\u4f60\u53ef\u4ee5\u5f88\u5feb\u7684\u9032\u884c\u6e2c\u8a66\u3002&lt;&lt;(?i)te(?-i)st&gt;&gt;\u61c9\u8a72\u7b26\u5408TEst\uff0c\u4f46\u662f\u4e0d\u80fd\u7b26\u5408teST\u6216TEST.<\/p>\n<p> <font color=\"#800080\"><strong>13.&nbsp; \u539f\u5b50\u7d44\u8207\u9632\u6b62\u56de\u6eaf<\/strong><\/font><\/p>\n<p> \u5728\u4e00\u4e9b\u7279\u6b8a\u60c5\u6cc1\u4e0b\uff0c\u56e0\u70ba\u56de\u6eaf\u6703\u4f7f\u5f97\u5f15\u64ce\u7684\u6548\u7387\u6975\u5176\u4f4e\u4e0b\u3002<\/p>\n<p> \u8b93\u6211\u5011\u770b\u4e00\u500b\u4f8b\u5b50\uff1a\u8981\u7b26\u5408\u9019\u6a23\u7684\u5b57\u4e32\uff0c\u5b57\u4e32\u4e2d\u7684\u6bcf\u500b\u6b04\u4f4d\u9593\u7528\u9017\u865f\u505a\u5206\u9694\u8a2d\u5b9a\uff0c\u7b2c12\u500b\u6b04\u4f4d\u7531P\u958b\u982d\u3002<\/p>\n<p> \u6211\u5011\u5bb9\u6613\u60f3\u5230\u9019\u6a23\u7684\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt;^(.*?,){11}P&gt;&gt;\u3002\u9019\u500b\u6b63\u5247\u8868\u9054\u5f0f\u5728\u6a19\u6e96\u60c5\u6cc1\u4e0b\u5de5\u4f5c\u7684\u5f88\u597d\u3002\u4f46\u662f\u5728\u6975\u7aef\u60c5\u6cc1\u4e0b\uff0c\u5982\u679c\u7b2c12\u500b\u6b04\u4f4d\u4e0d\u662f\u7531P\u958b\u982d\uff0c\u5247\u6703\u767c\u751f\u707d\u96e3\u6027\u7684\u56de\u6eaf\u3002\u5982\u8981\u641c\u5c0b\u7684\u5b57\u4e32\u70ba\u300c1,2,3,4,5,6,7,8,9,10,11,12,13\u300d\u3002\u9996\u5148\uff0c\u6b63\u5247\u8868\u9054\u5f0f\u4e00\u76f4\u5b8c\u6210\u7b26\u5408\u76f4\u5230\u7b2c12\u500b\u5b57\u5143\u3002\u9019\u6642\uff0c\u524d\u9762\u7684\u6b63\u5247\u8868\u9054\u5f0f\u6d88\u8017\u7684\u5b57\u4e32\u70ba\u300c1,2,3,4,5,6,7,8,9,10,11,\u300d\uff0c\u5230\u4e86\u4e0b\u4e00\u500b\u5b57\u5143\uff0c&lt;&lt;P&gt;&gt;\u4e26\u4e0d\u7b26\u5408\u300c12\u300d\u3002\u6240\u4ee5\u5f15\u64ce\u9032\u884c\u56de\u6eaf\uff0c\u9019\u6642\u6b63\u5247\u8868\u9054\u5f0f\u6d88\u8017\u7684\u5b57\u4e32\u70ba\u300c1,2,3,4,5,6,7,8,9,10,11\u300d\u3002\u7e7c\u7e8c\u4e0b\u4e00\u6b21\u7b26\u5408\u904e\u7a0b\uff0c\u4e0b\u4e00\u500b\u6b63\u5247\u7b26\u865f\u70ba\u9ede\u865f&lt;&lt;.&gt;&gt;\uff0c\u53ef\u4ee5\u7b26\u5408\u4e0b\u4e00\u500b\u9017\u865f\u300c,\u300d\u3002\u7136\u800c&lt;&lt;\uff0c&gt;&gt;\u4e26\u4e0d\u7b26\u5408\u5b57\u5143\u300c12\u300d\u4e2d\u7684\u300c1\u300d\u3002\u7b26\u5408\u5931\u6557\uff0c\u7e7c\u7e8c\u56de\u6eaf\u3002\u5927\u5bb6\u53ef\u4ee5\u60f3\u50cf\uff0c\u9019\u6a23\u7684\u56de\u6eaf\u7d44\u5408\u662f\u500b\u975e\u5e38\u5927\u7684\u6578\u91cf\u3002\u56e0\u6b64\u53ef\u80fd\u6703\u9020\u6210\u5f15\u64ce\u5d29\u6f70\u3002<\/p>\n<p> \u7528\u65bc\u963b\u6b62\u9019\u6a23\u5de8\u5927\u7684\u56de\u6eaf\u6709\u5e7e\u7a2e\u5c08\u6848\uff1a<\/p>\n<p> \u4e00\u7a2e\u7c21\u55ae\u7684\u5c08\u6848\u662f\u76e1\u53ef\u80fd\u7684\u4f7f\u7b26\u5408\u7cbe\u78ba\u3002\u7528\u53d6\u53cd\u5b57\u96c6\u4ee3\u66ff\u9ede\u865f\u3002\u4f8b\u5982\u6211\u5011\u7528\u5982\u4e0b\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt;^([^,<br \/>\n]*,){11}P&gt;&gt;\uff0c\u9019\u6a23\u53ef\u4ee5\u4f7f\u5931\u6557\u56de\u6eaf\u7684\u6b21\u6578\u4e0b\u964d\u523011\u6b21\u3002<\/p>\n<p> \u53e6\u4e00\u7a2e\u5c08\u6848\u662f\u4f7f\u7528\u539f\u5b50\u7d44\u3002<\/p>\n<p> \u539f\u5b50\u7d44\u7684\u76ee\u7684\u662f\u4f7f\u6b63\u5247\u5f15\u64ce\u5931\u6557\u7684\u66f4\u5feb\u4e00\u9ede\u3002\u56e0\u6b64\u53ef\u4ee5\u6709\u6548\u7684\u963b\u6b62\u6d77\u91cf\u56de\u6eaf\u3002\u539f\u5b50\u7d44\u7684\u8a9e\u6cd5\u662f&lt;&lt;(?&gt;\u6b63\u5247\u8868\u9054\u5f0f)&gt;&gt;\u3002\u4f4d\u65bc(?&gt;)\u4e4b\u9593\u7684\u6240\u6709\u6b63\u5247\u8868\u9054\u5f0f\u90fd\u6703\u88ab\u8a8d\u70ba\u662f\u4e00\u500b\u55ae\u4e00\u7684\u6b63\u5247\u7b26\u865f\u3002\u4e00\u65e6\u7b26\u5408\u5931\u6557\uff0c\u5f15\u64ce\u5c07\u6703\u56de\u6eaf\u5230\u539f\u5b50\u7d44\u524d\u9762\u7684\u6b63\u5247\u8868\u9054\u5f0f\u90e8\u5206\u3002\u524d\u9762\u7684\u4f8b\u5b50\u7528\u539f\u5b50\u7d44\u53ef\u4ee5\u8868\u9054\u6210&lt;&lt;^(?&gt;(.*?,){11})P&gt;&gt;\u3002\u4e00\u65e6\u7b2c\u5341\u4e8c\u500b\u6b04\u4f4d\u7b26\u5408\u5931\u6557\uff0c\u5f15\u64ce\u56de\u6eaf\u5230\u539f\u5b50\u7d44\u524d\u9762\u7684&lt;&lt;^&gt;&gt;\u3002<\/p>\n<p> <font color=\"#0000FF\"><strong>14.&nbsp; \u5411\u524d\u6aa2\u8996\u8207\u5411\u5f8c\u6aa2\u8996<\/strong><\/font><\/p>\n<p> Perl 5 \u5f15\u5165\u4e86\u5169\u500b\u5f37\u5927\u7684\u6b63\u5247\u8a9e\u6cd5\uff1a\u300c\u5411\u524d\u6aa2\u8996\u300d\u548c\u300c\u5411\u5f8c\u6aa2\u8996\u300d\u3002\u4ed6\u5011\u4e5f\u88ab\u7a31\u4f5c\u300c\u96f6\u9577\u5ea6\u65b7\u8a00\u300d\u3002\u4ed6\u5011\u548c\u9328\u5b9a\u4e00\u6a23\u90fd\u662f\u96f6\u9577\u5ea6\u7684\uff08\u6240\u8b02\u96f6\u9577\u5ea6\u5373\u6307\u8a72\u6b63\u5247\u8868\u9054\u5f0f\u4e0d\u6d88\u8017\u88ab\u7b26\u5408\u7684\u5b57\u4e32\uff09\u3002\u4e0d\u540c\u4e4b\u8655\u5728\u65bc\u300c\u524d\u5f8c\u6aa2\u8996\u300d\u6703\u5be6\u969b\u7b26\u5408\u5b57\u5143\uff0c\u53ea\u662f\u4ed6\u5011\u6703\u62cb\u68c4\u7b26\u5408\u53ea\u8fd4\u56de\u7b26\u5408\u7d50\u679c\uff1a\u7b26\u5408\u6216\u4e0d\u7b26\u5408\u3002\u9019\u5c31\u662f\u70ba\u4ec0\u9ebc\u4ed6\u5011\u88ab\u7a31\u4f5c\u300c\u65b7\u8a00\u300d\u3002\u4ed6\u5011\u4e26\u4e0d\u5be6\u969b\u6d88\u8017\u5b57\u4e32\u4e2d\u7684\u5b57\u5143\uff0c\u800c\u53ea\u662f\u65b7\u8a00\u4e00\u500b\u7b26\u5408\u662f\u5426\u53ef\u80fd\u3002<\/p>\n<p> \u5e7e\u4e4e\u672c\u6587\u8a0e\u8ad6\u7684\u6240\u6709\u6b63\u5247\u8868\u9054\u5f0f\u7684\u5be6\u73fe\u90fd\u652f\u63f4\u300c\u5411\u524d\u56ae\u5f8c\u6aa2\u8996\u300d\u3002\u552f\u4e00\u7684\u4e00\u500b\u4f8b\u5916\u662fJavascript\u53ea\u652f\u63f4\u5411\u524d\u6aa2\u8996\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u80af\u5b9a\u548c\u5426\u5b9a\u5f0f\u7684\u5411\u524d\u6aa2\u8996<\/p>\n<p> \u5982\u6211\u5011\u524d\u9762\u63d0\u904e\u7684\u4e00\u500b\u4f8b\u5b50\uff1a\u8981\u5c0b\u627e\u4e00\u500bq\uff0c\u5f8c\u9762\u6c92\u6709\u7dca\u8ddf\u4e00\u500bu\u3002\u4e5f\u5c31\u662f\u8aaa\uff0c\u8981\u9ebcq\u5f8c\u9762\u6c92\u6709\u5b57\u5143\uff0c\u8981\u9ebc\u5f8c\u9762\u7684\u5b57\u5143\u4e0d\u662fu\u3002\u63a1\u7528\u5426\u5b9a\u5f0f\u5411\u524d\u6aa2\u8996\u5f8c\u7684\u4e00\u500b\u89e3\u6c7a\u5c08\u6848\u70ba&lt;&lt;q(?!u)&gt;&gt;\u3002\u5426\u5b9a\u5f0f\u5411\u524d\u6aa2\u8996\u7684\u8a9e\u6cd5\u662f&lt;&lt;(?!\u6aa2\u8996\u7684\u5167\u5bb9)&gt;&gt;\u3002<\/p>\n<p> \u80af\u5b9a\u5f0f\u5411\u524d\u6aa2\u8996\u548c\u5426\u5b9a\u5f0f\u5411\u524d\u6aa2\u8996\u5f88\u985e\u4f3c\uff1a&lt;&lt;(?=\u6aa2\u8996\u7684\u5167\u5bb9)&gt;&gt;\u3002<\/p>\n<p> \u5982\u679c\u5728\u300c\u6aa2\u8996\u7684\u5167\u5bb9\u300d\u90e8\u5206\u6709\u7d44\uff0c\u4e5f\u6703\u7522\u751f\u4e00\u500b\u5411\u5f8c\u5f15\u7528\u3002\u4f46\u662f\u5411\u524d\u6aa2\u8996\u672c\u8eab\u4e26\u4e0d\u6703\u7522\u751f\u5411\u5f8c\u5f15\u7528\uff0c\u4e5f\u4e0d\u6703\u88ab\u8a08\u5165\u5411\u5f8c\u5f15\u7528\u7684\u7de8\u865f\u4e2d\u3002\u9019\u662f\u56e0\u70ba\u5411\u524d\u6aa2\u8996\u672c\u8eab\u662f\u6703\u88ab\u62cb\u68c4\u6389\u7684\uff0c\u53ea\u4fdd\u7559\u7b26\u5408\u8207\u5426\u7684\u5224\u65b7\u7d50\u679c\u3002\u5982\u679c\u4f60\u60f3\u4fdd\u7559\u7b26\u5408\u7684\u7d50\u679c\u4f5c\u70ba\u5411\u5f8c\u5f15\u7528\uff0c\u4f60\u53ef\u4ee5\u7528&lt;&lt;(?=(regex))&gt;&gt;\u4f86\u7522\u751f\u4e00\u500b\u5411\u5f8c\u5f15\u7528\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u80af\u5b9a\u548c\u5426\u5b9a\u5f0f\u7684\u5148\u5f8c\u6aa2\u8996<\/p>\n<p> \u5411\u5f8c\u6aa2\u8996\u548c\u5411\u524d\u6aa2\u8996\u6709\u76f8\u540c\u7684\u6548\u679c\uff0c\u53ea\u662f\u65b9\u5411\u76f8\u53cd<\/p>\n<p> \u5426\u5b9a\u5f0f\u5411\u5f8c\u6aa2\u8996\u7684\u8a9e\u6cd5\u662f\uff1a&lt;&lt;(?&lt;!\u6aa2\u8996\u5167\u5bb9)&gt;&gt;<\/p>\n<p> \u80af\u5b9a\u5f0f\u5411\u5f8c\u6aa2\u8996\u7684\u8a9e\u6cd5\u662f\uff1a&lt;&lt;(?&lt;=\u6aa2\u8996\u5167\u5bb9)&gt;&gt;<\/p>\n<p> \u6211\u5011\u53ef\u4ee5\u770b\u5230\uff0c\u548c\u5411\u524d\u6aa2\u8996\u76f8\u6bd4\uff0c\u591a\u4e86\u4e00\u500b\u8868\u793a\u65b9\u5411\u7684\u5de6\u5c16\u62ec\u865f\u3002<\/p>\n<p> \u4f8b\uff1a&lt;&lt;(?&lt;!a)b&gt;&gt;\u5c07\u6703\u7b26\u5408\u4e00\u500b\u6c92\u6709\u300ca\u300d\u4f5c\u524d\u5c0e\u5b57\u5143\u7684\u300cb\u300d\u3002<\/p>\n<p> \u503c\u5f97\u6ce8\u610f\u7684\u662f\uff1a\u5411\u524d\u6aa2\u8996\u5f9e\u73fe\u7528\u7684\u5b57\u4e32\u4f4d\u7f6e\u958b\u59cb\u5c0d\u300c\u6aa2\u8996\u300d\u6b63\u5247\u8868\u9054\u5f0f\u9032\u884c\u7b26\u5408\uff1b\u5411\u5f8c\u6aa2\u8996\u5247\u5f9e\u73fe\u7528\u7684\u5b57\u4e32\u4f4d\u7f6e\u958b\u59cb\u5148\u5f8c\u56de\u6eaf\u4e00\u500b\u5b57\u5143\uff0c\u7136\u5f8c\u518d\u958b\u59cb\u5c0d\u300c\u6aa2\u8996\u300d\u6b63\u5247\u8868\u9054\u5f0f\u9032\u884c\u7b26\u5408\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u6df1\u5165\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u5167\u5b9a<\/p>\n<p> \u8b93\u6211\u5011\u770b\u4e00\u500b\u7c21\u55ae\u4f8b\u5b50\u3002<\/p>\n<p> \u628a\u6b63\u5247\u8868\u9054\u5f0f&lt;&lt;q(?!u)&gt;&gt;\u61c9\u7528\u5230\u5b57\u4e32\u300cIraq\u300d\u3002\u6b63\u5247\u8868\u9054\u5f0f\u7684\u7b2c\u4e00\u500b\u7b26\u865f\u662f&lt;&lt;q&gt;&gt;\u3002\u6b63\u5982\u6211\u5011\u77e5\u9053\u7684\uff0c\u5f15\u64ce\u5728\u7b26\u5408&lt;&lt;q&gt;&gt;\u4ee5\u524d\u6703\u6383\u904e\u6574\u500b\u5b57\u4e32\u3002\u7576\u7b2c\u56db\u500b\u5b57\u5143\u300cq\u300d\u88ab\u7b26\u5408\u5f8c\uff0c\u300cq\u300d\u5f8c\u9762\u662f\u7a7a\u5b57\u5143(void)\u3002\u800c\u4e0b\u4e00\u500b\u6b63\u5247\u7b26\u865f\u662f\u5411\u524d\u6aa2\u8996\u3002\u5f15\u64ce\u6ce8\u610f\u5230\u5df2\u7d93\u9032\u5165\u4e86\u4e00\u500b\u5411\u524d\u6aa2\u8996\u6b63\u5247\u8868\u9054\u5f0f\u90e8\u5206\u3002\u4e0b\u4e00\u500b\u6b63\u5247\u7b26\u865f\u662f&lt;&lt;u&gt;&gt;\uff0c\u548c\u7a7a\u5b57\u5143\u4e0d\u7b26\u5408\uff0c\u5f9e\u800c\u5c0e\u81f4\u5411\u524d\u6aa2\u8996\u88e1\u7684\u6b63\u5247\u8868\u9054\u5f0f\u7b26\u5408\u5931\u6557\u3002\u56e0\u70ba\u662f\u4e00\u500b\u5426\u5b9a\u5f0f\u7684\u5411\u524d\u6aa2\u8996\uff0c\u610f\u5473\u8457\u6574\u500b\u5411\u524d\u6aa2\u8996\u7d50\u679c\u662f\u5b8c\u6210\u7684\u3002\u65bc\u662f\u7b26\u5408\u7d50\u679c\u300cq\u300d\u88ab\u8fd4\u56de\u4e86\u3002<\/p>\n<p> \u6211\u5011\u5728\u628a\u76f8\u540c\u7684\u6b63\u5247\u8868\u9054\u5f0f\u61c9\u7528\u5230\u300cquit\u300d\u3002&lt;&lt;q&gt;&gt;\u7b26\u5408\u4e86\u300cq\u300d\u3002\u4e0b\u4e00\u500b\u6b63\u5247\u7b26\u865f\u662f\u5411\u524d\u6aa2\u8996\u90e8\u5206\u7684&lt;&lt;u&gt;&gt;\uff0c\u5b83\u7b26\u5408\u4e86\u5b57\u4e32\u4e2d\u7684\u7b2c\u4e8c\u500b\u5b57\u5143\u300ci\u300d\u3002\u5f15\u64ce\u7e7c\u7e8c\u8d70\u5230\u4e0b\u500b\u5b57\u5143\u300ci\u300d\u3002\u7136\u800c\u5f15\u64ce\u9019\u6642\u6ce8\u610f\u5230\u5411\u524d\u6aa2\u8996\u90e8\u5206\u5df2\u7d93\u8655\u7406\u5b8c\u4e86\uff0c\u4e26\u4e14\u5411\u524d\u6aa2\u8996\u5df2\u7d93\u5b8c\u6210\u3002\u65bc\u662f\u5f15\u64ce\u62cb\u68c4\u88ab\u7b26\u5408\u7684\u5b57\u4e32\u90e8\u5206\uff0c\u9019\u5c07\u5c0e\u81f4\u5f15\u64ce\u56de\u9000\u5230\u5b57\u5143\u300cu\u300d\u3002<\/p>\n<p> \u56e0\u70ba\u5411\u524d\u6aa2\u8996\u662f\u5426\u5b9a\u5f0f\u7684\uff0c\u610f\u5473\u8457\u6aa2\u8996\u90e8\u5206\u7684\u5b8c\u6210\u7b26\u5408\u5c0e\u81f4\u4e86\u6574\u500b\u5411\u524d\u6aa2\u8996\u7684\u5931\u6557\uff0c\u56e0\u6b64\u5f15\u64ce\u4e0d\u5f97\u4e0d\u9032\u884c\u56de\u6eaf\u3002\u6700\u5f8c\u56e0\u70ba\u518d\u6c92\u6709\u5176\u4ed6\u7684\u300cq\u300d\u548c&lt;&lt;q&gt;&gt;\u7b26\u5408\uff0c\u6240\u4ee5\u6574\u500b\u7b26\u5408\u5931\u6557\u4e86\u3002<\/p>\n<p> \u70ba\u4e86\u78ba\u4fdd\u4f60\u80fd\u6e05\u695a\u5730\u7406\u89e3\u5411\u524d\u6aa2\u8996\u7684\u5be6\u73fe\uff0c\u8b93\u6211\u5011\u628a&lt;&lt;q(?=u)i&gt;&gt;\u61c9\u7528\u5230\u300cquit\u300d\u3002&lt;&lt;q&gt;&gt;\u9996\u5148\u7b26\u5408\u300cq\u300d\u3002\u7136\u5f8c\u5411\u524d\u6aa2\u8996\u5b8c\u6210\u7b26\u5408\u300cu\u300d\uff0c\u7b26\u5408\u7684\u90e8\u5206\u88ab\u62cb\u68c4\uff0c\u53ea\u8fd4\u56de\u53ef\u4ee5\u7b26\u5408\u7684\u5224\u65b7\u7d50\u679c\u3002\u5f15\u64ce\u5f9e\u5b57\u5143\u300ci\u300d\u56de\u9000\u5230\u300cu\u300d\u3002\u7531\u65bc\u5411\u524d\u6aa2\u8996\u5b8c\u6210\u4e86\uff0c\u5f15\u64ce\u7e7c\u7e8c\u8655\u7406\u4e0b\u4e00\u500b\u6b63\u5247\u7b26\u865f&lt;&lt;i&gt;&gt;\u3002\u7d50\u679c\u767c\u73fe&lt;&lt;i&gt;&gt;\u548c\u300cu\u300d\u4e0d\u7b26\u5408\u3002\u56e0\u6b64\u7b26\u5408\u5931\u6557\u4e86\u3002\u7531\u65bc\u5f8c\u9762\u6c92\u6709\u5176\u4ed6\u7684\u300cq\u300d\uff0c\u6574\u500b\u6b63\u5247\u8868\u9054\u5f0f\u7684\u7b26\u5408\u5931\u6557\u4e86\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u66f4\u9032\u4e00\u6b65\u7406\u89e3\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u5167\u5b9a\u6a5f\u5236<\/p>\n<p> \u8b93\u6211\u5011\u628a&lt;&lt;(?&lt;=a)b&gt;&gt;\u61c9\u7528\u5230\u300cthingamabob\u300d\u3002\u5f15\u64ce\u958b\u59cb\u8655\u7406\u5411\u5f8c\u6aa2\u8996\u90e8\u5206\u7684\u6b63\u5247\u7b26\u865f\u548c\u5b57\u4e32\u4e2d\u7684\u7b2c\u4e00\u500b\u5b57\u5143\u3002\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\uff0c\u5411\u5f8c\u6aa2\u8996\u544a\u8a34\u6b63\u5247\u8868\u9054\u5f0f\u5f15\u64ce\u56de\u9000\u4e00\u500b\u5b57\u5143\uff0c\u7136\u5f8c\u6aa2\u8996\u662f\u5426\u6709\u4e00\u500b\u300ca\u300d\u88ab\u7b26\u5408\u3002\u56e0\u70ba\u5728\u300ct\u300d\u524d\u9762\u6c92\u6709\u5b57\u5143\uff0c\u6240\u4ee5\u5f15\u64ce\u4e0d\u80fd\u56de\u9000\u3002\u56e0\u6b64\u5411\u5f8c\u6aa2\u8996\u5931\u6557\u4e86\u3002\u5f15\u64ce\u7e7c\u7e8c\u8d70\u5230\u4e0b\u4e00\u500b\u5b57\u5143\u300ch\u300d\u3002\u518d\u4e00\u6b21\uff0c\u5f15\u64ce\u66ab\u6642\u56de\u9000\u4e00\u500b\u5b57\u5143\u4e26\u6aa2\u67e5\u662f\u5426\u6709\u500b\u300ca\u300d\u88ab\u7b26\u5408\u3002\u7d50\u679c\u767c\u73fe\u4e86\u4e00\u500b\u300ct\u300d\u3002\u5411\u5f8c\u6aa2\u8996\u53c8\u5931\u6557\u4e86\u3002<\/p>\n<p> \u5411\u5f8c\u6aa2\u8996\u7e7c\u7e8c\u5931\u6557\uff0c\u76f4\u5230\u6b63\u5247\u8868\u9054\u5f0f\u5230\u9054\u4e86\u5b57\u4e32\u4e2d\u7684\u300cm\u300d\uff0c\u65bc\u662f\u80af\u5b9a\u5f0f\u7684\u5411\u5f8c\u6aa2\u8996\u88ab\u7b26\u5408\u4e86\u3002\u56e0\u70ba\u5b83\u662f\u96f6\u9577\u5ea6\u7684\uff0c\u5b57\u4e32\u7684\u73fe\u7528\u7684\u4f4d\u7f6e\u4ecd\u7136\u662f\u300cm\u300d\u3002\u4e0b\u4e00\u500b\u6b63\u5247\u7b26\u865f\u662f&lt;&lt;b&gt;&gt;\uff0c\u548c\u300cm\u300d\u7b26\u5408\u5931\u6557\u3002\u4e0b\u4e00\u500b\u5b57\u5143\u662f\u5b57\u4e32\u4e2d\u7684\u7b2c\u4e8c\u500b\u300ca\u300d\u3002\u5f15\u64ce\u5411\u5f8c\u66ab\u6642\u56de\u9000\u4e00\u500b\u5b57\u5143\uff0c\u4e26\u4e14\u767c\u73fe&lt;&lt;a&gt;&gt;\u4e0d\u7b26\u5408\u300cm\u300d\u3002<\/p>\n<p> \u5728\u4e0b\u4e00\u500b\u5b57\u5143\u662f\u5b57\u4e32\u4e2d\u7684\u7b2c\u4e00\u500b\u300cb\u300d\u3002\u5f15\u64ce\u66ab\u6642\u6027\u7684\u5411\u5f8c\u9000\u4e00\u500b\u5b57\u5143\u767c\u73fe\u5411\u5f8c\u6aa2\u8996\u88ab\u6eff\u8db3\u4e86\uff0c\u540c\u6642&lt;&lt;b&gt;&gt;\u7b26\u5408\u4e86\u300cb\u300d\u3002\u56e0\u6b64\u6574\u500b\u6b63\u5247\u8868\u9054\u5f0f\u88ab\u7b26\u5408\u4e86\u3002\u4f5c\u70ba\u7d50\u679c\uff0c\u6b63\u5247\u8868\u9054\u5f0f\u8fd4\u56de\u5b57\u4e32\u4e2d\u7684\u7b2c\u4e00\u500b\u300cb\u300d\u3002<\/p>\n<p> &nbsp;&nbsp;&nbsp; \u5411\u524d\u56ae\u5f8c\u6aa2\u8996\u7684\u61c9\u7528<\/p>\n<p> \u6211\u5011\u4f86\u770b\u9019\u6a23\u4e00\u500b\u4f8b\u5b50\uff1a\u5c0b\u627e\u4e00\u500b\u5177\u67096\u4f4d\u5b57\u5143\u7684\uff0c\u542b\u6709\u300ccat\u300d\u7684\u55ae\u8a5e\u3002<\/p>\n<p> \u9996\u5148\uff0c\u6211\u5011\u53ef\u4ee5\u4e0d\u7528\u5411\u524d\u56ae\u5f8c\u6aa2\u8996\u4f86\u89e3\u6c7a\u554f\u984c\uff0c\u4f8b\u5982\uff1a<\/p>\n<p> &lt;&lt; catw{3}|wcatw{2}|w{2}catw|w{3}cat&gt;&gt;<\/p>\n<p> \u8db3\u5920\u7c21\u55ae\u5427\uff01\u4f46\u662f\u7576\u9700\u6c42\u8b8a\u6210\u5c0b\u627e\u4e00\u500b\u5177\u67096-12\u4f4d\u5b57\u5143\uff0c\u542b\u6709\u300ccat\u300d\uff0c\u300cdog\u300d\u6216\u300cmouse\u300d\u7684\u55ae\u8a5e\u6642\uff0c\u9019\u7a2e\u65b9\u6cd5\u5c31\u8b8a\u5f97\u6709\u4e9b\u7b28\u62d9\u4e86\u3002<\/p>\n<p> \u6211\u5011\u4f86\u770b\u770b\u4f7f\u7528\u5411\u524d\u6aa2\u8996\u7684\u5c08\u6848\u3002\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\uff0c\u6211\u5011\u6709\u5169\u500b\u57fa\u672c\u9700\u6c42\u8981\u6eff\u8db3\uff1a\u4e00\u662f\u6211\u5011\u9700\u8981\u4e00\u500b6\u4f4d\u7684\u5b57\u5143\uff0c\u4e8c\u662f\u55ae\u8a5e\u542b\u6709\u300ccat\u300d\u3002<\/p>\n<p> \u6eff\u8db3\u7b2c\u4e00\u500b\u9700\u6c42\u7684\u6b63\u5247\u8868\u9054\u5f0f\u70ba&lt;&lt;\bw{6}\b&gt;&gt;\u3002\u6eff\u8db3\u7b2c\u4e8c\u500b\u9700\u6c42\u7684\u6b63\u5247\u8868\u9054\u5f0f\u70ba&lt;&lt;\bw*catw*\b&gt;&gt;\u3002<\/p>\n<p> \u628a\u5169\u8005\u7d50\u5408\u8d77\u4f86\uff0c\u6211\u5011\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u7684\u6b63\u5247\u8868\u9054\u5f0f\uff1a<\/p>\n<p> &lt;&lt;(?=\bw{6}\b)\bw*catw*\b&gt;&gt;<\/p>\n<p> \u5177\u9ad4\u7684\u7b26\u5408\u904e\u7a0b\u7559\u7d66\u8b80\u8005\u3002\u4f46\u662f\u8981\u6ce8\u610f\u7684\u4e00\u9ede\u662f\uff0c\u5411\u524d\u6aa2\u8996\u662f\u4e0d\u6d88\u8017\u5b57\u5143\u7684\uff0c\u56e0\u6b64\u7576\u5224\u65b7\u55ae\u8a5e\u6eff\u8db3\u5177\u67096\u500b\u5b57\u5143\u7684\u689d\u4ef6\u5f8c\uff0c\u5f15\u64ce\u6703\u5f9e\u958b\u59cb\u5224\u65b7\u524d\u7684\u4f4d\u7f6e\u7e7c\u7e8c\u5c0d\u5f8c\u9762\u7684\u6b63\u5247\u8868\u9054\u5f0f\u9032\u884c\u7b26\u5408\u3002<\/p>\n<p> \u6700\u5f8c\u4f5c\u4e9b\u6539\u5584\uff0c\u53ef\u4ee5\u5f97\u5230\u4e0b\u9762\u7684\u6b63\u5247\u8868\u9054\u5f0f\uff1a<\/p>\n<p> &lt;&lt;\b(?=w{6}\b)w{0,3}catw*&gt;&gt;<\/p>\n<p> <font color=\"#800000\"><strong>15.&nbsp; \u6b63\u5247\u8868\u9054\u5f0f\u4e2d\u7684\u689d\u4ef6\u6e2c\u8a66<\/strong><\/font><\/p>\n<p> \u689d\u4ef6\u6e2c\u8a66\u7684\u8a9e\u6cd5\u70ba&lt;&lt;(?ifthen|else)&gt;&gt;\u3002\u300cif\u300d\u90e8\u5206\u53ef\u4ee5\u662f\u5411\u524d\u56ae\u5f8c\u6aa2\u8996\u8868\u9054\u5f0f\u3002\u5982\u679c\u7528\u5411\u524d\u6aa2\u8996\uff0c\u5247\u8a9e\u6cd5\u8b8a\u70ba\uff1a&lt;&lt;(?(?=regex)then|else)&gt;&gt;\uff0c\u5176\u4e2delse\u90e8<br \/>\n\u5206\u662f\u53ef\u9078\u7684\u3002<\/p>\n<p> \u5982\u679cif\u90e8\u5206\u70batrue\uff0c\u5247\u6b63\u5247\u5f15\u64ce\u6703\u8a66\u5716\u7b26\u5408then\u90e8\u5206\uff0c\u5426\u5247\u5f15\u64ce\u6703\u8a66\u5716\u7b26\u5408else\u90e8\u5206\u3002<\/p>\n<p> \u9700\u8981\u8a18\u4f4f\u7684\u662f\uff0c\u5411\u524d\u5148\u5f8c\u6aa2\u8996\u4e26\u4e0d\u5be6\u969b\u6d88\u8017\u4efb\u4f55\u5b57\u5143\uff0c\u56e0\u6b64\u5f8c\u9762\u7684then\u8207else\u90e8\u5206\u7684\u7b26\u5408\u6642\u5f9eif\u6e2c\u8a66\u524d\u7684\u90e8\u5206\u958b\u59cb\u9032\u884c\u5617\u8a66\u3002<br \/> <font color=\"#008000\"><strong><br \/> 16.&nbsp; \u70ba\u6b63\u5247\u8868\u9054\u5f0f\u52a0\u5165\u8a3b\u91cb<\/strong><\/font><\/p>\n<p> \u5728\u6b63\u5247\u8868\u9054\u5f0f\u4e2d\u52a0\u5165\u8a3b\u91cb\u7684\u8a9e\u6cd5\u662f\uff1a&lt;&lt;(?#comment)&gt;&gt;<\/p>\n<p> \u4f8b\uff1a\u70ba\u7528\u65bc\u7b26\u5408\u6709\u6548\u65e5\u671f\u7684\u6b63\u5247\u8868\u9054\u5f0f\u52a0\u5165\u8a3b\u91cb\uff1a<\/p>\n<p> (?#year)(19|20)dd[- \/.](?#month)(0[1-9]|1[012])[- \/.](?#day)(0[1-9]|[12][0-9]|3[01])<br \/> \u539f\u6587\u51fa\u8655:http:\/\/imsiren.com\/archives\/560<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b63\u5247\u8868\u9054\u5f0f\u662f\u4e00\u500b\u7121\u6bd4\u5f37\u5927\u7684\u5de5\u5177.\u4efb\u4f55\u5730\u65b9\u6211\u5011\u90fd\u53ef\u80fd\u7528\u5230\u5b83&hellip; \u539f\u4f86\u523b\u82e6\u7684\u5543\u904e \u6b63\u5247\u8868\u9054\u5f0f,\u4f46\u6642\u9593\u9577 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":376,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[22],"class_list":["post-89","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/89"}],"collection":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/89\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media\/376"}],"wp:attachment":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media?parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/categories?post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/tags?post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}