﻿{"id":112,"date":"2009-07-12T10:12:17","date_gmt":"2009-07-12T10:12:17","guid":{"rendered":""},"modified":"2011-11-18T16:59:23","modified_gmt":"2011-11-18T08:59:23","slug":"112","status":"publish","type":"post","link":"http:\/\/zerobox.org\/notes\/112.html","title":{"rendered":"JS\u7684\u6b63\u5219\u8868\u8fbe\u5f0f"},"content":{"rendered":"<p><span style=\"font-size: x-small;\">JS\u7684\u6b63\u5219\u8868\u8fbe\u5f0f<\/span><\/p>\n<p>\/\/\u6821\u9a8c\u662f\u5426\u5168\u7531\u6570\u5b57\u7ec4\u6210<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction isDigit(s)<br \/>\n{<br \/>\nvar patrn=\/^[0-9]{1,20}$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<\/p>\n<p>\/\/\u6821\u9a8c\u767b\u5f55\u540d\uff1a\u53ea\u80fd\u8f93\u51655-20\u4e2a\u4ee5\u5b57\u6bcd\u5f00\u5934\u3001\u53ef\u5e26\u6570\u5b57\u3001\u201c_\u201d\u3001\u201c.\u201d\u7684\u5b57\u4e32<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction isRegisterUserName(s)<br \/>\n{<br \/>\nvar patrn=\/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<\/p>\n<p>\/\/\u6821\u9a8c\u7528\u6237\u59d3\u540d\uff1a\u53ea\u80fd\u8f93\u51651-30\u4e2a\u4ee5\u5b57\u6bcd\u5f00\u5934\u7684\u5b57\u4e32<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction isTrueName(s)<br \/>\n{<br \/>\nvar patrn=\/^[a-zA-Z]{1,30}$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<br \/>\n}}<\/p>\n<p>\/\/\u6821\u9a8c\u5bc6\u7801\uff1a\u53ea\u80fd\u8f93\u51656-20\u4e2a\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u4e0b\u5212\u7ebf<br \/>\n[code]<br \/>\nfunction isPasswd(s)<br \/>\n{<br \/>\nvar patrn=\/^(w){6,20}$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<\/p>\n<p>\/\/\u6821\u9a8c\u666e\u901a\u7535\u8bdd\u3001\u4f20\u771f\u53f7\u7801\uff1a\u53ef\u4ee5\u201c+\u201d\u5f00\u5934\uff0c\u9664\u6570\u5b57\u5916\uff0c\u53ef\u542b\u6709\u201c-\u201d<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction isTel(s)<br \/>\n{<br \/>\n\/\/var patrn=\/^[+]{0,1}(d){1,3}[ ]?([-]?(d){1,12})+$\/;<br \/>\nvar patrn=\/^[+]{0,1}(d){1,3}[ ]?([-]?((d)|[ ]){1,12})+$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<\/p>\n<p>\/\/\u6821\u9a8c<span class=\"t_tag\" onclick=\"tagshow(event)\">\u624b\u673a\u53f7<\/span>\u7801\uff1a\u5fc5\u987b\u4ee5\u6570\u5b57\u5f00\u5934\uff0c\u9664\u6570\u5b57\u5916\uff0c\u53ef\u542b\u6709\u201c-\u201d<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction isMobil(s)<br \/>\n{<br \/>\nvar patrn=\/^[+]{0,1}(d){1,3}[ ]?([-]?((d)|[ ]){1,12})+$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<\/p>\n<p>\/\/\u6821\u9a8c\u90ae\u653f\u7f16\u7801<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction isPostalCode(s)<br \/>\n{<br \/>\n\/\/var patrn=\/^[a-zA-Z0-9]{3,12}$\/;<br \/>\nvar patrn=\/^[a-zA-Z0-9 ]{3,12}$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<\/p>\n<p>\/\/\u6821\u9a8c\u641c\u7d22\u5173\u952e\u5b57<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction isSearch(s)<br \/>\n{<br \/>\nvar patrn=\/^[^`~!@#$%^&amp;*()+=|\\][]{}:;&amp;#39;,.&lt;&gt;\/?]{1}[^`~!@$%^&amp;()+=|\\]<br \/>\n[]{}:;&amp;#39;,.&lt;&gt;?]{0,19}$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<\/p>\n<p>function isIP(s) \/\/by zergling<br \/>\n{<br \/>\nvar patrn=\/^[0-9.]{1,20}$\/;<br \/>\nif (!patrn.exec(s)) return false<br \/>\nreturn true<br \/>\n}<\/p>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f<\/p>\n<p>\u4ee3\u7801<br \/>\n&#8220;^\\d+$&#8221;\u3000\u3000\/\/\u975e\u8d1f\u6574\u6570\uff08\u6b63\u6574\u6570 + 0\uff09<br \/>\n&#8220;^[0-9]*[1-9][0-9]*$&#8221;\u3000\u3000\/\/\u6b63\u6574\u6570<br \/>\n&#8220;^((-\\d+)|(0+))$&#8221;\u3000\u3000\/\/\u975e\u6b63\u6574\u6570\uff08\u8d1f\u6574\u6570 + 0\uff09<br \/>\n&#8220;^-[0-9]*[1-9][0-9]*$&#8221;\u3000\u3000\/\/\u8d1f\u6574\u6570<br \/>\n&#8220;^-?\\d+$&#8221;\u3000\u3000\u3000\u3000\/\/\u6574\u6570<br \/>\n&#8220;^\\d+(\\.\\d+)?$&#8221;\u3000\u3000\/\/\u975e\u8d1f\u6d6e\u70b9\u6570\uff08\u6b63\u6d6e\u70b9\u6570 + 0\uff09<br \/>\n&#8220;^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$&#8221;<br \/>\n\/\/\u6b63\u6d6e\u70b9\u6570<br \/>\n&#8220;^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$&#8221;\u3000\u3000\/\/\u975e\u6b63\u6d6e\u70b9\u6570\uff08\u8d1f\u6d6e\u70b9\u6570 + 0\uff09<br \/>\n&#8220;^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$&#8221;<br \/>\n\/\/\u8d1f\u6d6e\u70b9\u6570<br \/>\n&#8220;^(-?\\d+)(\\.\\d+)?$&#8221;\u3000\u3000\/\/\u6d6e\u70b9\u6570<br \/>\n&#8220;^[A-Za-z]+$&#8221;\u3000\u3000\/\/\u753126\u4e2a\u82f1\u6587\u5b57\u6bcd\u7ec4\u6210\u7684\u5b57\u7b26\u4e32<br \/>\n&#8220;^[A-Z]+$&#8221;\u3000\u3000\/\/\u753126\u4e2a\u82f1\u6587\u5b57\u6bcd\u7684\u5927\u5199\u7ec4\u6210\u7684\u5b57\u7b26\u4e32<br \/>\n&#8220;^[a-z]+$&#8221;\u3000\u3000\/\/\u753126\u4e2a\u82f1\u6587\u5b57\u6bcd\u7684\u5c0f\u5199\u7ec4\u6210\u7684\u5b57\u7b26\u4e32<br \/>\n&#8220;^[A-Za-z0-9]+$&#8221;\u3000\u3000\/\/\u7531\u6570\u5b57\u548c26\u4e2a\u82f1\u6587\u5b57\u6bcd\u7ec4\u6210\u7684\u5b57\u7b26\u4e32<br \/>\n&#8220;^\\w+$&#8221;\u3000\u3000\/\/\u7531\u6570\u5b57\u300126\u4e2a\u82f1\u6587\u5b57\u6bcd\u6216\u8005\u4e0b\u5212\u7ebf\u7ec4\u6210\u7684\u5b57\u7b26\u4e32<br \/>\n&#8220;^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$&#8221;\u3000\u3000\u3000\u3000\/\/email\u5730\u5740<br \/>\n&#8220;^[a-zA-z]+:\/\/(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$&#8221;\u3000\u3000\/\/url<br \/>\n&#8220;^[A-Za-z0-9_]*$&#8221;<\/p>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u4f7f\u7528\u8be6\u89e3<\/p>\n<p>\u7b80\u4ecb<\/p>\n<p>\u7b80\u5355\u7684\u8bf4\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u79cd\u53ef\u4ee5\u7528\u4e8e\u6a21\u5f0f\u5339\u914d\u548c\u66ff\u6362\u7684\u5f3a\u6709\u529b\u7684\u5de5\u5177\u3002\u5176\u4f5c\u7528\u5982\u4e0b\uff1a<br \/>\n\u6d4b\u8bd5\u5b57\u7b26\u4e32\u7684\u67d0\u4e2a\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5bf9\u4e00\u4e2a\u8f93\u5165\u5b57\u7b26\u4e32\u8fdb\u884c\u6d4b\u8bd5\uff0c\u770b\u5728\u8be5\u5b57\u7b26\u4e32\u662f\u5426\u5b58\u5728\u4e00\u4e2a\u7535\u8bdd\u53f7\u7801\u6a21\u5f0f\u6216\u4e00\u4e2a\u4fe1\u7528\u5361\u53f7\u7801\u6a21\u5f0f\u3002\u8fd9\u79f0\u4e3a\u6570\u636e\u6709\u6548\u6027\u9a8c\u8bc1\u3002<br \/>\n\u66ff\u6362\u6587\u672c\u3002\u53ef\u4ee5\u5728\u6587\u6863\u4e2d\u4f7f\u7528\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u6807\u8bc6\u7279\u5b9a\u6587\u5b57\uff0c\u7136\u540e\u53ef\u4ee5\u5168\u90e8\u5c06\u5176\u5220\u9664\uff0c\u6216\u8005\u66ff\u6362\u4e3a\u522b\u7684\u6587\u5b57\u3002<br \/>\n\u6839\u636e\u6a21\u5f0f\u5339\u914d\u4ece\u5b57\u7b26\u4e32\u4e2d\u63d0\u53d6\u4e00\u4e2a\u5b50\u5b57\u7b26\u4e32\u3002\u53ef\u4ee5\u7528\u6765\u5728\u6587\u672c\u6216\u8f93\u5165\u5b57\u6bb5\u4e2d\u67e5\u627e\u7279\u5b9a\u6587\u5b57\u3002<\/p>\n<p>\u57fa\u672c\u8bed\u6cd5<\/p>\n<p>\u5728\u5bf9\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u529f\u80fd\u548c\u4f5c\u7528\u6709\u4e86\u521d\u6b65\u7684\u4e86\u89e3\u4e4b\u540e\uff0c\u6211\u4eec\u5c31\u6765\u5177\u4f53\u770b\u4e00\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u8bed\u6cd5\u683c\u5f0f\u3002<\/p>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5f62\u5f0f\u4e00\u822c\u5982\u4e0b\uff1a<\/p>\n<p>\/love\/\u3000\u3000\u5176\u4e2d\u4f4d\u4e8e\u201c\/\u201d\u5b9a\u754c\u7b26\u4e4b\u95f4\u7684\u90e8\u5206\u5c31\u662f\u5c06\u8981\u5728\u76ee\u6807\u5bf9\u8c61\u4e2d\u8fdb\u884c\u5339\u914d\u7684\u6a21\u5f0f\u3002\u7528\u6237\u53ea\u8981\u628a\u5e0c\u671b\u67e5\u627e\u5339\u914d\u5bf9\u8c61\u7684\u6a21\u5f0f\u5185\u5bb9\u653e\u5165\u201c\/\u201d\u5b9a\u754c\u7b26\u4e4b\u95f4\u5373\u53ef\u3002\u4e3a\u4e86\u80fd\u591f\u4f7f\u7528\u6237\u66f4\u52a0\u7075\u6d3b\u7684\u5b9a\u5236\u6a21\u5f0f\u5185\u5bb9\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u4f9b\u4e86\u4e13\u95e8\u7684\u201c\u5143\u5b57\u7b26\u201d\u3002\u6240\u8c13\u5143\u5b57\u7b26\u5c31\u662f\u6307\u90a3\u4e9b\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5177\u6709\u7279\u6b8a\u610f\u4e49\u7684\u4e13\u7528\u5b57\u7b26\uff0c\u53ef\u4ee5\u7528\u6765\u89c4\u5b9a\u5176\u524d\u5bfc\u5b57\u7b26\uff08\u5373\u4f4d\u4e8e\u5143\u5b57\u7b26\u524d\u9762\u7684\u5b57\u7b26\uff09\u5728\u76ee\u6807\u5bf9\u8c61\u4e2d\u7684\u51fa\u73b0\u6a21\u5f0f\u3002<br \/>\n\u8f83\u4e3a\u5e38\u7528\u7684\u5143\u5b57\u7b26\u5305\u62ec\uff1a \u201c+\u201d\uff0c \u201c*\u201d\uff0c\u4ee5\u53ca \u201c?\u201d\u3002<\/p>\n<p>\u201c+\u201d\u5143\u5b57\u7b26\u89c4\u5b9a\u5176\u524d\u5bfc\u5b57\u7b26\u5fc5\u987b\u5728\u76ee\u6807\u5bf9\u8c61\u4e2d\u8fde\u7eed\u51fa\u73b0\u4e00\u6b21\u6216\u591a\u6b21\u3002<\/p>\n<p>\u201c*\u201d\u5143\u5b57\u7b26\u89c4\u5b9a\u5176\u524d\u5bfc\u5b57\u7b26\u5fc5\u987b\u5728\u76ee\u6807\u5bf9\u8c61\u4e2d\u51fa\u73b0\u96f6\u6b21\u6216\u8fde\u7eed\u591a\u6b21\u3002<\/p>\n<p>\u201c?\u201d\u5143\u5b57\u7b26\u89c4\u5b9a\u5176\u524d\u5bfc\u5bf9\u8c61\u5fc5\u987b\u5728\u76ee\u6807\u5bf9\u8c61\u4e2d\u8fde\u7eed\u51fa\u73b0\u96f6\u6b21\u6216\u4e00\u6b21\u3002<\/p>\n<p>\u4e0b\u9762\uff0c\u5c31\u8ba9\u6211\u4eec\u6765\u770b\u4e00\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\u5143\u5b57\u7b26\u7684\u5177\u4f53\u5e94\u7528\u3002<\/p>\n<p>\/fo+\/\u3000\u3000\u56e0\u4e3a\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5305\u542b\u201c+\u201d\u5143\u5b57\u7b26\uff0c\u8868\u793a\u53ef\u4ee5\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u7684 \u201cfool\u201d, \u201cfo\u201d, \u6216\u8005 \u201cfootball\u201d\u7b49\u5728\u5b57\u6bcdf\u540e\u9762\u8fde\u7eed\u51fa\u73b0\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcdo\u7684\u5b57\u7b26\u4e32\u76f8\u5339\u914d\u3002<\/p>\n<p>\/eg*\/\u3000\u3000\u56e0\u4e3a\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5305\u542b\u201c*\u201d\u5143\u5b57\u7b26\uff0c\u8868\u793a\u53ef\u4ee5\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u7684 \u201ceasy\u201d, \u201cego\u201d, \u6216\u8005 \u201cegg\u201d\u7b49\u5728\u5b57\u6bcde\u540e\u9762\u8fde\u7eed\u51fa\u73b0\u96f6\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcdg\u7684\u5b57\u7b26\u4e32\u76f8\u5339\u914d\u3002<\/p>\n<p>\/Wil?\/\u3000\u3000\u56e0\u4e3a\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5305\u542b\u201c\uff1f\u201d\u5143\u5b57\u7b26\uff0c\u8868\u793a\u53ef\u4ee5\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u7684 \u201cWin\u201d, \u6216\u8005\u201cWilson\u201d,\u7b49\u5728\u5b57\u6bcdi\u540e\u9762\u8fde\u7eed\u51fa\u73b0\u96f6\u4e2a\u6216\u4e00\u4e2a\u5b57\u6bcdl\u7684\u5b57\u7b26\u4e32\u76f8\u5339\u914d\u3002<\/p>\n<p>\u6709\u65f6\u5019\u4e0d\u77e5\u9053\u8981\u5339\u914d\u591a\u5c11\u5b57\u7b26\u3002\u4e3a\u4e86\u80fd\u9002\u5e94\u8fd9\u79cd\u4e0d\u786e\u5b9a\u6027\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u652f\u6301\u9650\u5b9a\u7b26\u7684\u6982\u5ff5\u3002\u8fd9\u4e9b\u9650\u5b9a\u7b26\u53ef\u4ee5\u6307\u5b9a\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u4e00\u4e2a\u7ed9\u5b9a\u7ec4\u4ef6\u5fc5\u987b\u8981\u51fa\u73b0\u591a\u5c11\u6b21\u624d\u80fd\u6ee1\u8db3\u5339\u914d\u3002<\/p>\n<p>{n} n \u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u3002\u5339\u914d\u786e\u5b9a\u7684 n \u6b21\u3002\u4f8b\u5982\uff0c&amp;#39;o{2}&amp;#39; \u4e0d\u80fd\u5339\u914d &#8220;Bob&#8221; \u4e2d\u7684 &amp;#39;o&amp;#39;\uff0c\u4f46\u662f\u80fd\u5339\u914d &#8220;food&#8221; \u4e2d\u7684\u4e24\u4e2a o\u3002<\/p>\n<p>{n,} n \u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u3002\u81f3\u5c11\u5339\u914d n \u6b21\u3002\u4f8b\u5982\uff0c&amp;#39;o{2,}&amp;#39; \u4e0d\u80fd\u5339\u914d &#8220;Bob&#8221; \u4e2d\u7684 &amp;#39;o&amp;#39;\uff0c\u4f46\u80fd\u5339\u914d &#8220;foooood&#8221; \u4e2d\u7684\u6240\u6709 o\u3002&amp;#39;o{1,}&amp;#39; \u7b49\u4ef7\u4e8e &amp;#39;o+&amp;#39;\u3002&amp;#39;o{0,}&amp;#39; \u5219\u7b49\u4ef7\u4e8e &amp;#39;o*&amp;#39;\u3002<\/p>\n<p>{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\u4f8b\u5982\uff0c&#8221;o{1,3}&#8221; \u5c06\u5339\u914d &#8220;fooooood&#8221; \u4e2d\u7684\u524d\u4e09\u4e2a o\u3002&amp;#39;o{0,1}&amp;#39; \u7b49\u4ef7\u4e8e &amp;#39;o?&amp;#39;\u3002\u8bf7\u6ce8\u610f\u5728\u9017\u53f7\u548c\u4e24\u4e2a\u6570\u4e4b\u95f4\u4e0d\u80fd\u6709\u7a7a\u683c\u3002<\/p>\n<p>\u9664\u4e86\u5143\u5b57\u7b26\u4e4b\u5916\uff0c\u7528\u6237\u8fd8\u53ef\u4ee5\u7cbe\u786e\u6307\u5b9a\u6a21\u5f0f\u5728\u5339\u914d\u5bf9\u8c61\u4e2d\u51fa\u73b0\u7684\u9891\u7387\u3002\u4f8b\u5982\uff0c\/jim {2,6}\/ \u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u89c4\u5b9a\u5b57\u7b26m\u53ef\u4ee5\u5728\u5339\u914d\u5bf9\u8c61\u4e2d\u8fde\u7eed\u51fa\u73b02-6\u6b21\uff0c\u56e0\u6b64\uff0c\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u4ee5\u540cjimmy\u6216jimmmmmy\u7b49\u5b57\u7b26\u4e32\u76f8\u5339\u914d\u3002<br \/>\n\u5728\u5bf9\u5982\u4f55\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6709\u4e86\u521d\u6b65\u4e86\u89e3\u4e4b\u540e\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e0b\u5176\u5b83\u51e0\u4e2a\u91cd\u8981\u7684\u5143\u5b57\u7b26\u7684\u4f7f\u7528\u65b9\u5f0f\u3002<\/p>\n<p>\u4ee3\u7801<br \/>\ns\uff1a\u7528\u4e8e\u5339\u914d\u5355\u4e2a\u7a7a\u683c\u7b26\uff0c\u5305\u62ectab\u952e\u548c\u6362\u884c\u7b26\uff1b<br \/>\nS\uff1a\u7528\u4e8e\u5339\u914d\u9664\u5355\u4e2a\u7a7a\u683c\u7b26\u4e4b\u5916\u7684\u6240\u6709\u5b57\u7b26\uff1b<br \/>\nd\uff1a\u7528\u4e8e\u5339\u914d\u4ece0\u52309\u7684\u6570\u5b57\uff1b<br \/>\nw\uff1a\u7528\u4e8e\u5339\u914d\u5b57\u6bcd\uff0c\u6570\u5b57\u6216\u4e0b\u5212\u7ebf\u5b57\u7b26\uff1b<br \/>\nW\uff1a\u7528\u4e8e\u5339\u914d\u6240\u6709\u4e0ew\u4e0d\u5339\u914d\u7684\u5b57\u7b26\uff1b<br \/>\n. \uff1a\u7528\u4e8e\u5339\u914d\u9664\u6362\u884c\u7b26\u4e4b\u5916\u7684\u6240\u6709\u5b57\u7b26\u3002<\/p>\n<p>\uff08\u8bf4\u660e\uff1a\u6211\u4eec\u53ef\u4ee5\u628as\u548cS\u4ee5\u53caw\u548cW\u770b\u4f5c\u4e92\u4e3a\u9006\u8fd0\u7b97\uff09<br \/>\n\u4e0b\u9762\uff0c\u6211\u4eec\u5c31\u901a\u8fc7\u5b9e\u4f8b\u770b\u4e00\u4e0b\u5982\u4f55\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u4f7f\u7528\u4e0a\u8ff0\u5143\u5b57\u7b26\u3002<br \/>\n\/s+\/ \u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u4ee5\u7528\u4e8e\u5339\u914d\u76ee\u6807\u5bf9\u8c61\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u7a7a\u683c\u5b57\u7b26\u3002<br \/>\n\/d000\/\u3000\u5982\u679c\u6211\u4eec\u624b\u4e2d\u6709\u4e00\u4efd\u590d\u6742\u7684\u8d22\u52a1\u62a5\u8868\uff0c\u90a3\u4e48\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u8f7b\u800c\u6613\u4e3e\u7684\u67e5\u627e\u5230\u6240\u6709\u603b\u989d\u8fbe\u5343\u5143\u7684\u6b3e\u9879\u3002<br \/>\n\u9664\u4e86\u6211\u4eec\u4ee5\u4e0a\u6240\u4ecb\u7ecd\u7684\u5143\u5b57\u7b26\u4e4b\u5916\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u8fd8\u5177\u6709\u53e6\u5916\u4e00\u79cd\u8f83\u4e3a\u72ec\u7279\u7684\u4e13\u7528\u5b57\u7b26\uff0c\u5373\u5b9a\u4f4d\u7b26\u3002\u5b9a\u4f4d\u7b26\u7528\u4e8e\u89c4\u5b9a\u5339\u914d\u6a21\u5f0f\u5728\u76ee\u6807\u5bf9\u8c61\u4e2d\u7684\u51fa\u73b0\u4f4d\u7f6e\u3002 \u8f83\u4e3a\u5e38\u7528\u7684\u5b9a\u4f4d\u7b26\u5305\u62ec\uff1a \u201c^\u201d, \u201c$\u201d, \u201c\b\u201d \u4ee5\u53ca \u201cB\u201d\u3002<\/p>\n<p>\u4ee3\u7801<br \/>\n\u201c^\u201d\u5b9a\u4f4d\u7b26\u89c4\u5b9a\u5339\u914d\u6a21\u5f0f\u5fc5\u987b\u51fa\u73b0\u5728\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u5f00\u5934<br \/>\n\u201c$\u201d\u5b9a\u4f4d\u7b26\u89c4\u5b9a\u5339\u914d\u6a21\u5f0f\u5fc5\u987b\u51fa\u73b0\u5728\u76ee\u6807\u5bf9\u8c61\u7684\u7ed3\u5c3e<br \/>\n\u201c\b\u201d\u5b9a\u4f4d\u7b26\u89c4\u5b9a\u5339\u914d\u6a21\u5f0f\u5fc5\u987b\u51fa\u73b0\u5728\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u5f00\u5934\u6216\u7ed3\u5c3e\u7684\u4e24\u4e2a\u8fb9\u754c\u4e4b\u4e00<br \/>\n\u201cB\u201d\u5b9a\u4f4d\u7b26\u5219\u89c4\u5b9a\u5339\u914d\u5bf9\u8c61\u5fc5\u987b\u4f4d\u4e8e\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u5f00\u5934\u548c\u7ed3\u5c3e\u4e24\u4e2a\u8fb9\u754c\u4e4b\u5185\uff0c<br \/>\n\u5373\u5339\u914d\u5bf9\u8c61\u65e2\u4e0d\u80fd\u4f5c\u4e3a\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u5f00\u5934\uff0c\u4e5f\u4e0d\u80fd\u4f5c\u4e3a\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u7ed3\u5c3e\u3002<\/p>\n<p>\u540c\u6837\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u628a\u201c^\u201d\u548c\u201c$\u201d\u4ee5\u53ca\u201c\b\u201d\u548c\u201cB\u201d\u770b\u4f5c\u662f\u4e92\u4e3a\u9006\u8fd0\u7b97\u7684\u4e24\u7ec4\u5b9a\u4f4d\u7b26\u3002\u4e3e\u4f8b\u6765\u8bf4\uff1a \/^hell\/\u3000\u56e0\u4e3a\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5305\u542b\u201c^\u201d\u5b9a\u4f4d\u7b26\uff0c\u6240\u4ee5\u53ef\u4ee5\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u4ee5 \u201chell\u201d, \u201chello\u201d\u6216\u201chellhound\u201d\u5f00\u5934\u7684\u5b57\u7b26\u4e32\u76f8\u5339\u914d\u3002 \/ar$\/\u3000\u56e0\u4e3a\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5305\u542b\u201c$\u201d\u5b9a\u4f4d\u7b26\uff0c\u6240\u4ee5\u53ef\u4ee5\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u4ee5 \u201ccar\u201d, \u201cbar\u201d\u6216 \u201car\u201d \u7ed3\u5c3e\u7684\u5b57\u7b26\u4e32\u76f8\u5339\u914d\u3002 \/\bbom\/\u3000\u56e0\u4e3a\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u4ee5\u201c\b\u201d\u5b9a\u4f4d\u7b26\u5f00\u5934\uff0c\u6240\u4ee5\u53ef\u4ee5\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u4ee5 \u201cbomb\u201d, \u6216 \u201cbom\u201d\u5f00\u5934\u7684\u5b57\u7b26\u4e32\u76f8\u5339\u914d\u3002\/man\b\/\u3000\u56e0\u4e3a\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u4ee5\u201c\b\u201d\u5b9a\u4f4d\u7b26\u7ed3\u5c3e\uff0c\u6240\u4ee5\u53ef\u4ee5\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u4ee5 \u201chuman\u201d, \u201cwoman\u201d\u6216 \u201cman\u201d\u7ed3\u5c3e\u7684\u5b57\u7b26\u4e32\u76f8\u5339\u914d\u3002<br \/>\n\u4e3a\u4e86\u80fd\u591f\u65b9\u4fbf\u7528\u6237\u66f4\u52a0\u7075\u6d3b\u7684\u8bbe\u5b9a\u5339\u914d\u6a21\u5f0f\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u5141\u8bb8\u4f7f\u7528\u8005\u5728\u5339\u914d\u6a21\u5f0f\u4e2d\u6307\u5b9a\u67d0\u4e00\u4e2a\u8303\u56f4\u800c\u4e0d\u5c40\u9650\u4e8e\u5177\u4f53\u7684\u5b57\u7b26\u3002\u4f8b\u5982\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\n\/[A-Z]\/\u3000\u3000\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u4f1a\u4e0e\u4eceA\u5230Z\u8303\u56f4\u5185\u4efb\u4f55\u4e00\u4e2a\u5927\u5199\u5b57\u6bcd\u76f8\u5339\u914d\u3002<br \/>\n\/[a-z]\/\u3000\u3000\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u4f1a\u4e0e\u4ecea\u5230z\u8303\u56f4\u5185\u4efb\u4f55\u4e00\u4e2a\u5c0f\u5199\u5b57\u6bcd\u76f8\u5339\u914d\u3002<br \/>\n\/[0-9]\/ \u3000\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u4f1a\u4e0e\u4ece0\u52309\u8303\u56f4\u5185\u4efb\u4f55\u4e00\u4e2a\u6570\u5b57\u76f8\u5339\u914d\u3002<br \/>\n\/([a-z][A-Z][0-9])+\/\u3000\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u4f1a\u4e0e\u4efb\u4f55\u7531\u5b57\u6bcd\u548c\u6570\u5b57\u7ec4\u6210\u7684\u5b57\u7b26\u4e32\uff0c\u5982 \u201caB0\u201d \u7b49\u76f8\u5339\u914d\u3002<\/p>\n<p>\u8fd9\u91cc\u9700\u8981\u63d0\u9192\u7528\u6237\u6ce8\u610f\u7684\u4e00\u70b9\u5c31\u662f\u53ef\u4ee5\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u4f7f\u7528 \u201c()\u201d \u628a\u5b57\u7b26\u4e32\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u201c()\u201d\u7b26\u53f7\u5305\u542b\u7684\u5185\u5bb9\u5fc5\u987b\u540c\u65f6\u51fa\u73b0\u5728\u76ee\u6807\u5bf9\u8c61\u4e2d\u3002\u56e0\u6b64\uff0c\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u65e0\u6cd5\u4e0e\u8bf8\u5982 \u201cabc\u201d\u7b49\u7684\u5b57\u7b26\u4e32\u5339\u914d\uff0c\u56e0\u4e3a\u201cabc\u201d\u4e2d\u7684\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u4e3a\u5b57\u6bcd\u800c\u975e\u6570\u5b57\u3002<br \/>\n\u5982\u679c\u6211\u4eec\u5e0c\u671b\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u5b9e\u73b0\u7c7b\u4f3c\u7f16\u7a0b\u903b\u8f91\u4e2d\u7684\u201c\u6216\u201d\u8fd0\u7b97\uff0c\u5728\u591a\u4e2a\u4e0d\u540c\u7684\u6a21\u5f0f\u4e2d\u4efb\u9009\u4e00\u4e2a\u8fdb\u884c\u5339\u914d\u7684\u8bdd\uff0c\u53ef\u4ee5\u4f7f\u7528\u7ba1\u9053\u7b26 \u201c|\u201d\u3002\u4f8b\u5982\uff1a\/to|too|2\/\u3000\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u4f1a\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u7684 \u201cto\u201d, \u201ctoo\u201d, \u6216 \u201c2\u201d \u76f8\u5339\u914d\u3002<br \/>\n\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u8fd8\u6709\u4e00\u4e2a\u8f83\u4e3a\u5e38\u7528\u7684\u8fd0\u7b97\u7b26\uff0c\u5373\u5426\u5b9a\u7b26 \u201c[^]\u201d\u3002\u4e0e\u6211\u4eec\u524d\u6587\u6240\u4ecb\u7ecd\u7684\u5b9a\u4f4d\u7b26 \u201c^\u201d \u4e0d\u540c\uff0c\u5426\u5b9a\u7b26 \u201c[^]\u201d\u89c4\u5b9a\u76ee\u6807\u5bf9\u8c61\u4e2d\u4e0d\u80fd\u5b58\u5728\u6a21\u5f0f\u4e2d\u6240\u89c4\u5b9a\u7684\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff1a\/[^A-C]\/\u3000\u4e0a\u8ff0\u5b57\u7b26\u4e32\u5c06\u4f1a\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u9664A\uff0cB\uff0c\u548cC\u4e4b\u5916\u7684\u4efb\u4f55\u5b57\u7b26\u76f8\u5339\u914d\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u5f53\u201c^\u201d\u51fa\u73b0\u5728 \u201c[]\u201d\u5185\u65f6\u5c31\u88ab\u89c6\u505a\u5426\u5b9a\u8fd0\u7b97\u7b26\uff1b\u800c\u5f53\u201c^\u201d\u4f4d\u4e8e\u201c[]\u201d\u4e4b\u5916\uff0c\u6216\u6ca1\u6709\u201c[]\u201d\u65f6\uff0c\u5219\u5e94\u5f53\u88ab\u89c6\u505a\u5b9a\u4f4d\u7b26\u3002<br \/>\n\u6700\u540e\uff0c\u5f53\u7528\u6237\u9700\u8981\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u6a21\u5f0f\u4e2d\u52a0\u5165\u5143\u5b57\u7b26\uff0c\u5e76\u67e5\u627e\u5176\u5339\u914d\u5bf9\u8c61\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u8f6c\u4e49\u7b26\u201c\u201d\u3002\u4f8b\u5982\uff1a\/Th*\/ \u3000\u4e0a\u8ff0\u6b63\u5219\u8868\u8fbe\u5f0f\u5c06\u4f1a\u4e0e\u76ee\u6807\u5bf9\u8c61\u4e2d\u7684\u201cTh*\u201d\u800c\u975e\u201cThe\u201d\u7b49\u76f8\u5339\u914d\u3002<br \/>\n\u5728\u6784\u9020\u6b63\u5219\u8868\u8fbe\u5f0f\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u8c61\u6570\u5b66\u8868\u8fbe\u5f0f\u4e00\u6837\u6765\u6c42\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u53ef\u4ee5\u4ece\u5de6\u81f3\u53f3\u5e76\u6309\u7167\u4e00\u4e2a\u4f18\u5148\u7ea7\u987a\u5e8f\u6765\u6c42\u503c\u3002\u4f18\u5148\u7ea7\u5982\u4e0b\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\n1\uff0e \u8f6c\u4e49\u7b26<br \/>\n2\uff0e(), (?:), (?=), [] \u5706\u62ec\u53f7\u548c\u65b9\u62ec\u53f7<br \/>\n3\uff0e*, +, ?, {n}, {n,}, {n,m} \u9650\u5b9a\u7b26<br \/>\n4\uff0e^, $, anymetacharacter \u4f4d\u7f6e\u548c\u987a\u5e8f<br \/>\n5\uff0e|\u201c\u6216\u201d\u64cd\u4f5c<\/p>\n<p>\u4f7f\u7528\u5b9e\u4f8b<br \/>\n\u5728JavaScript 1.2\u4e2d\u5e26\u6709\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684RegExp()\u5bf9\u8c61\uff0c\u53ef\u4ee5\u7528\u6765\u8fdb\u884c\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\u64cd\u4f5c\u3002\u5176\u4e2d\u7684test()\u65b9\u6cd5\u53ef\u4ee5\u68c0\u9a8c\u76ee\u6807\u5bf9\u8c61\u4e2d\u662f\u5426\u5305\u542b\u5339\u914d\u6a21\u5f0f\uff0c\u5e76\u76f8\u5e94\u7684\u8fd4\u56detrue\u6216false\u3002<br \/>\n\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528JavaScript\u7f16\u5199\u4ee5\u4e0b\u811a\u672c\uff0c\u9a8c\u8bc1\u7528\u6237\u8f93\u5165\u7684\u90ae\u4ef6\u5730\u5740\u7684\u6709\u6548\u6027\u3002<\/p>\n<p>\u4ee3\u7801<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;script language=&#8221;Javascript1.2&#8243;&gt;<br \/>\n&lt;!&#8211; start hiding<br \/>\nfunction verifyAddress(obj)<br \/>\n{<br \/>\nvar email = obj.email.value;<br \/>\nvar pattern =<br \/>\n\/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+\/;<br \/>\nflag = pattern.test(email);<br \/>\nif(flag)<br \/>\n{<br \/>\nalert(\u201cYour email address is correct!\u201d);<br \/>\nreturn true;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nalert(\u201cPlease try again!\u201d);<br \/>\nreturn false;<br \/>\n}<br \/>\n}<br \/>\n\/\/ stop hiding &#8211;&gt;<br \/>\n&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\n&lt;form onSubmit=&#8221;return verifyAddress(this);&#8221;&gt;<br \/>\n&lt;input name=&#8221;email&#8221; type=&#8221;text&#8221;&gt;<br \/>\n&lt;input type=&#8221;submit&#8221;&gt;<br \/>\n&lt;\/form&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61<br \/>\n\u672c\u5bf9\u8c61\u5305\u542b\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u4ee5\u53ca\u8868\u660e\u5982\u4f55\u5e94\u7528\u6a21\u5f0f\u7684\u6807\u5fd7\u3002<\/p>\n<p>\u4ee3\u7801<br \/>\n\u8bed\u6cd5 1 re = \/pattern\/[flags]<br \/>\n\u8bed\u6cd5 2 re = new RegExp(&#8220;pattern&#8221;,[&#8220;flags&#8221;])<\/p>\n<p>\u53c2\u6570<br \/>\nre<br \/>\n\u5fc5\u9009\u9879\u3002\u5c06\u8981\u8d4b\u503c\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u7684\u53d8\u91cf\u540d\u3002<\/p>\n<p>Pattern<br \/>\n\u5fc5\u9009\u9879\u3002\u8981\u4f7f\u7528\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u3002\u5982\u679c\u4f7f\u7528\u8bed\u6cd5 1\uff0c\u7528 &#8220;\/&#8221; \u5b57\u7b26\u5206\u9694\u6a21\u5f0f\u3002\u5982\u679c\u7528\u8bed\u6cd5 2\uff0c\u7528\u5f15\u53f7\u5c06\u6a21\u5f0f\u5f15\u8d77\u6765\u3002<\/p>\n<p>Flags<br \/>\n\u53ef\u9009\u9879\u3002\u5982\u679c\u4f7f\u7528\u8bed\u6cd5 2 \u8981\u7528\u5f15\u53f7\u5c06 flag \u5f15\u8d77\u6765\u3002\u6807\u5fd7\u53ef\u4ee5\u7ec4\u5408\u4f7f\u7528\uff0c\u53ef\u7528\u7684\u6709\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\ng \uff08\u5168\u6587\u67e5\u627e\u51fa\u73b0\u7684\u6240\u6709 pattern\uff09<br \/>\ni \uff08\u5ffd\u7565\u5927\u5c0f\u5199\uff09<br \/>\nm \uff08\u591a\u884c\u67e5\u627e\uff09<\/p>\n<p>\u793a\u4f8b<br \/>\n\u4e0b\u9762\u7684\u793a\u4f8b\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u53ca\u76f8\u5173\u6807\u5fd7\u7684\u5bf9\u8c61(re)\uff0c\u5411\u60a8\u6f14\u793a\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61\u7684\u7528\u6cd5\u3002\u5728\u672c\u4f8b\u4e2d\uff0c\u4f5c\u4e3a\u7ed3\u679c\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61\u53c8\u7528\u4e8e match \u65b9\u6cd5\u4e2d\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction MatchDemo()<br \/>\n{<br \/>\nvar r, re; \/\/ \u58f0\u660e\u53d8\u91cf\u3002<br \/>\nvar s = &#8220;The rain in Spain falls mainly in the plain&#8221;;<br \/>\nre = new RegExp(&#8220;ain&#8221;,&#8221;g&#8221;); \/\/ \u521b\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61\u3002<br \/>\nr = s.match(re); \/\/ \u5728\u5b57\u7b26\u4e32 s \u4e2d\u67e5\u627e\u5339\u914d\u3002<br \/>\nreturn(r);<br \/>\n}<\/p>\n<p>\u8fd4\u56de\u503c\uff1a ain,ain,ain,ain\\<br \/>\n\u5c5e\u6027 lastIndex \u5c5e\u6027 | source \u5c5e\u6027\\<br \/>\n\u65b9\u6cd5 compile \u65b9\u6cd5 | exec \u65b9\u6cd5 | test \u65b9\u6cd5\\<br \/>\n\u8981\u6c42 \u7248\u672c 3\\<br \/>\n\u8bf7\u53c2\u9605 RegExp \u5bf9\u8c61 | \u6b63\u5219\u8868\u8fbe\u5f0f\u8bed\u6cd5 | String \u5bf9\u8c61\\<\/p>\n<p>exec \u65b9\u6cd5<br \/>\n\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u5728\u5b57\u7b26\u4e32\u4e2d\u8fd0\u884c\u67e5\u627e\uff0c\u5e76\u8fd4\u56de\u5305\u542b\u8be5\u67e5\u627e\u7ed3\u679c\u7684\u4e00\u4e2a\u6570\u7ec4\u3002<br \/>\nrgExp.exec(str)<\/p>\n<p>\u53c2\u6570<\/p>\n<p>rgExp<br \/>\n\u5fc5\u9009\u9879\u3002\u5305\u542b\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u548c\u53ef\u7528\u6807\u5fd7\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61\u3002<\/p>\n<p>str<br \/>\n\u5fc5\u9009\u9879\u3002\u8981\u5728\u5176\u4e2d\u6267\u884c\u67e5\u627e\u7684 String \u5bf9\u8c61\u6216\u5b57\u7b26\u4e32\u6587\u5b57\u3002<\/p>\n<p>\u8bf4\u660e\\<br \/>\n\u5982\u679c exec \u65b9\u6cd5\u6ca1\u6709\u627e\u5230\u5339\u914d\uff0c\u5219\u5b83\u8fd4\u56de null\u3002\u5982\u679c\u5b83\u627e\u5230\u5339\u914d\uff0c\u5219 exec \u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\uff0c\u5e76\u4e14\u66f4\u65b0\u5168\u5c40 RegExp \u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u4ee5\u53cd\u6620\u5339\u914d\u7ed3\u679c\u3002\u6570\u7ec4\u76840\u5143\u7d20\u5305\u542b\u4e86\u5b8c\u6574\u7684\u5339\u914d\uff0c\u800c\u7b2c1\u5230n\u5143\u7d20\u4e2d\u5305\u542b\u7684\u662f\u5339\u914d\u4e2d\u51fa\u73b0\u7684\u4efb\u610f\u4e00\u4e2a\u5b50\u5339\u914d\u3002\u8fd9\u76f8\u5f53\u4e8e\u6ca1\u6709\u8bbe\u7f6e\u5168\u5c40\u6807\u5fd7 (g) \u7684 match \u65b9\u6cd5\u3002<br \/>\n\u5982\u679c\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f\u8bbe\u7f6e\u4e86\u5168\u5c40\u6807\u5fd7\uff0cexec \u4ece\u4ee5 lastIndex \u7684\u503c\u6307\u793a\u7684\u4f4d\u7f6e\u5f00\u59cb\u67e5\u627e\u3002\u5982\u679c\u6ca1\u6709\u8bbe\u7f6e\u5168\u5c40\u6807\u5fd7\uff0cexec \u5ffd\u7565 lastIndex \u7684\u503c\uff0c\u4ece\u5b57\u7b26\u4e32\u7684\u8d77\u59cb\u4f4d\u7f6e\u5f00\u59cb\u641c\u7d22\u3002<\/p>\n<p>exec \u65b9\u6cd5\u8fd4\u56de\u7684\u6570\u7ec4\u6709\u4e09\u4e2a\u5c5e\u6027\uff0c\u5206\u522b\u662f input\u3001index \u548c lastIndex\u3002Input \u5c5e\u6027\u5305\u542b\u4e86\u6574\u4e2a\u88ab\u67e5\u627e\u7684\u5b57\u7b26\u4e32\u3002Index \u5c5e\u6027\u4e2d\u5305\u542b\u4e86\u6574\u4e2a\u88ab\u67e5\u627e\u5b57\u7b26\u4e32\u4e2d\u88ab\u5339\u914d\u7684\u5b50\u5b57\u7b26\u4e32\u7684\u4f4d\u7f6e\u3002LastIndex \u5c5e\u6027\u4e2d\u5305\u542b\u4e86\u5339\u914d\u4e2d\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0b\u4e00\u4e2a\u4f4d\u7f6e\u3002<\/p>\n<p>\u793a\u4f8b\\<br \/>\n\u4e0b\u9762\u7684\u4f8b\u5b50\u4e3e\u4f8b\u8bf4\u660e\u4e86 exec \u65b9\u6cd5\u7684\u7528\u6cd5\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction RegExpTest()<br \/>\n{<br \/>\nvar ver = Number(ScriptEngineMajorVersion() + &#8220;.&#8221; + ScriptEngineMinorVersion())<br \/>\nif (ver &gt;= 5.5){ \/\/ \u6d4b\u8bd5 JScript \u7684\u7248\u672c\u3002<br \/>\nvar src = &#8220;The rain in Spain falls mainly in the plain.&#8221;;<br \/>\nvar re = \/w+\/g; \/\/ \u521b\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u3002<br \/>\nvar arr;<br \/>\nwhile ((arr = re.exec(src)) != null)<br \/>\ndocument.write(arr.index + &#8220;-&#8221; + arr.lastIndex + arr + &#8221; &#8220;);<br \/>\n}<br \/>\nelse{<br \/>\nalert(&#8220;\u8bf7\u4f7f\u7528 JScript \u7684\u66f4\u65b0\u7248\u672c&#8221;);<br \/>\n}<br \/>\n}<\/p>\n<p>\u8fd4\u56de\u503c\uff1a0-3The 4-8rain 9-11in 12-17Spain 18-23falls 24-30mainly 31-33in 34-37the 38-43plain<\/p>\n<p>test \u65b9\u6cd5\\<br \/>\n\u8fd4\u56de\u4e00\u4e2a Boolean \u503c\uff0c\u5b83\u6307\u51fa\u5728\u88ab\u67e5\u627e\u7684\u5b57\u7b26\u4e32\u4e2d\u662f\u5426\u5b58\u5728\u6a21\u5f0f\u3002<br \/>\nrgexp.test(str)<\/p>\n<p>\u53c2\u6570\\<br \/>\nrgexp<br \/>\n\u5fc5\u9009\u9879\u3002\u5305\u542b\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u6216\u53ef\u7528\u6807\u5fd7\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61\u3002<\/p>\n<p>str<br \/>\n\u5fc5\u9009\u9879\u3002\u8981\u5728\u5176\u4e0a\u6d4b\u8bd5\u67e5\u627e\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<p>\u8bf4\u660e<br \/>\ntest \u65b9\u6cd5\u68c0\u67e5\u5728\u5b57\u7b26\u4e32\u4e2d\u662f\u5426\u5b58\u5728\u4e00\u4e2a\u6a21\u5f0f\uff0c\u5982\u679c\u5b58\u5728\u5219\u8fd4\u56de true\uff0c\u5426\u5219\u5c31\u8fd4\u56de false\u3002<br \/>\n\u5168\u5c40 RegExp \u5bf9\u8c61\u7684\u5c5e\u6027\u4e0d\u7531 test \u65b9\u6cd5\u6765\u4fee\u6539\u3002<\/p>\n<p>\u793a\u4f8b<br \/>\n\u4e0b\u9762\u7684\u4f8b\u5b50\u4e3e\u4f8b\u8bf4\u660e\u4e86 test \u65b9\u6cd5\u7684\u7528\u6cd5\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction TestDemo(re, s)<br \/>\n{<br \/>\nvar s1; \/\/ \u58f0\u660e\u53d8\u91cf\u3002<br \/>\n\/\/ \u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u5b58\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u3002<br \/>\nif (re.test(s)) \/\/ \u6d4b\u8bd5\u662f\u5426\u5b58\u5728\u3002<br \/>\ns1 = &#8221; contains &#8220;; \/\/ s \u5305\u542b\u6a21\u5f0f\u3002<br \/>\nelse<br \/>\ns1 = &#8221; does not contain &#8220;; \/\/ s \u4e0d\u5305\u542b\u6a21\u5f0f\u3002<br \/>\nreturn(&#8220;&amp;#39;&#8221; + s + &#8220;&amp;#39;&#8221; + s1 + &#8220;&amp;#39;&#8221;+ re.source + &#8220;&amp;#39;&#8221;); \/\/ \u8fd4\u56de\u5b57\u7b26\u4e32\u3002<br \/>\n}<\/p>\n<p>\u51fd\u6570\u8c03\u7528\uff1adocument.write (TestDemo(\/ain+\/ ,&#8221;The rain in Spain falls mainly in the plain.&#8221;));<\/p>\n<p>\u8fd4\u56de\u503c\uff1a&amp;#39;The rain in Spain falls mainly in the plain.&amp;#39; contains &amp;#39;ain+&amp;#39;<\/p>\n<p>match \u65b9\u6cd5<br \/>\n\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u5bf9\u5b57\u7b26\u4e32\u6267\u884c\u67e5\u627e\uff0c\u5e76\u5c06\u5305\u542b\u67e5\u627e\u7684\u7ed3\u679c\u4f5c\u4e3a\u6570\u7ec4\u8fd4\u56de\u3002\\<br \/>\nstringObj.match(rgExp)<\/p>\n<p>\u53c2\u6570\\<br \/>\nstringObj<br \/>\n\u5fc5\u9009\u9879\u3002\u5bf9\u5176\u8fdb\u884c\u67e5\u627e\u7684 String \u5bf9\u8c61\u6216\u5b57\u7b26\u4e32\u6587\u5b57\u3002<\/p>\n<p>rgExp<br \/>\n\u5fc5\u9009\u9879\u3002\u4e3a\u5305\u542b\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u548c\u53ef\u7528\u6807\u5fd7\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61\u3002\u4e5f\u53ef\u4ee5\u662f\u5305\u542b\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u548c\u53ef\u7528\u6807\u5fd7\u7684\u53d8\u91cf\u540d\u6216\u5b57\u7b26\u4e32\u6587\u5b57\u3002<\/p>\n<p>\u8bf4\u660e\\<br \/>\n\u5982\u679c match \u65b9\u6cd5\u6ca1\u6709\u627e\u5230\u5339\u914d\uff0c\u8fd4\u56de null\u3002\u5982\u679c\u627e\u5230\u5339\u914d\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\u5e76\u4e14\u66f4\u65b0\u5168\u5c40 RegExp \u5bf9\u8c61\u7684\u5c5e\u6027\u4ee5\u53cd\u6620\u5339\u914d\u7ed3\u679c\u3002<br \/>\nmatch \u65b9\u6cd5\u8fd4\u56de\u7684\u6570\u7ec4\u6709\u4e09\u4e2a\u5c5e\u6027\uff1ainput\u3001index \u548c lastIndex\u3002Input \u5c5e\u6027\u5305\u542b\u6574\u4e2a\u7684\u88ab\u67e5\u627e\u5b57\u7b26\u4e32\u3002Index \u5c5e\u6027\u5305\u542b\u4e86\u5728\u6574\u4e2a\u88ab\u67e5\u627e\u5b57\u7b26\u4e32\u4e2d\u5339\u914d\u7684\u5b50\u5b57\u7b26\u4e32\u7684\u4f4d\u7f6e\u3002LastIndex \u5c5e\u6027\u5305\u542b\u4e86\u6700\u540e\u4e00\u6b21\u5339\u914d\u4e2d\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0b\u4e00\u4e2a\u4f4d\u7f6e\u3002<br \/>\n\u5982\u679c\u6ca1\u6709\u8bbe\u7f6e\u5168\u5c40\u6807\u5fd7 (g)\uff0c\u6570\u7ec4\u7684 0 \u5143\u7d20\u5305\u542b\u6574\u4e2a\u5339\u914d\uff0c\u800c\u7b2c 1 \u5230 n \u5143\u7d20\u5305\u542b\u4e86\u5339\u914d\u4e2d\u66fe\u51fa\u73b0\u8fc7\u7684\u4efb\u4e00\u4e2a\u5b50\u5339\u914d\u3002\u8fd9\u76f8\u5f53\u4e8e\u6ca1\u6709\u8bbe\u7f6e\u5168\u5c40\u6807\u5fd7\u7684 exec \u65b9\u6cd5\u3002\u5982\u679c\u8bbe\u7f6e\u4e86\u5168\u5c40\u6807\u5fd7\uff0c\u5143\u7d20 0 \u5230 n \u4e2d\u5305\u542b\u6240\u6709\u5339\u914d\u3002<\/p>\n<p>\u793a\u4f8b\\<br \/>\n\u4e0b\u9762\u7684\u793a\u4f8b\u6f14\u793a\u4e86match \u65b9\u6cd5\u7684\u7528\u6cd5\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction MatchDemo()<br \/>\n{<br \/>\nvar r, re; \/\/ \u58f0\u660e\u53d8\u91cf\u3002<br \/>\nvar s = &#8220;The rain in Spain falls mainly in the plain&#8221;;<br \/>\nre = \/ain\/i; \/\/ \u521b\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u3002<br \/>\nr = s.match(re); \/\/ \u5c1d\u8bd5\u5339\u914d\u641c\u7d22\u5b57\u7b26\u4e32\u3002<br \/>\nreturn(r); \/\/ \u8fd4\u56de\u7b2c\u4e00\u6b21\u51fa\u73b0 &#8220;ain&#8221; \u7684\u5730\u65b9\u3002<br \/>\n}<\/p>\n<p>\u8fd4\u56de\u503c\uff1aain<\/p>\n<p>\u672c\u793a\u4f8b\u8bf4\u660e\u5e26 g \u6807\u5fd7\u8bbe\u7f6e\u7684 match \u65b9\u6cd5\u7684\u7528\u6cd5\u3002<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction MatchDemo()<br \/>\n{<br \/>\nvar r, re; \/\/ \u58f0\u660e\u53d8\u91cf\u3002<br \/>\nvar s = &#8220;The rain in Spain falls mainly in the plain&#8221;;<br \/>\nre = \/ain\/ig; \/\/ \u521b\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u3002<br \/>\nr = s.match(re); \/\/ \u5c1d\u8bd5\u53bb\u5339\u914d\u641c\u7d22\u5b57\u7b26\u4e32\u3002<br \/>\nreturn(r); \/\/ \u8fd4\u56de\u7684\u6570\u7ec4\u5305\u542b\u4e86\u6240\u6709 &#8220;ain&#8221;<br \/>\n\/\/ \u51fa\u73b0\u7684\u56db\u4e2a\u5339\u914d\u3002<br \/>\n}<\/p>\n<p>\u8fd4\u56de\u503c\uff1aain,ain,ain,ain<\/p>\n<p>\u4e0a\u9762\u51e0\u884c\u4ee3\u7801\u6f14\u793a\u4e86\u5b57\u7b26\u4e32\u6587\u5b57\u7684 match \u65b9\u6cd5\u7684\u7528\u6cd5\u3002<\/p>\n<p>\u4ee3\u7801<br \/>\nvar r, re = &#8220;Spain&#8221;;<br \/>\nr = &#8220;The rain in Spain&#8221;.replace(re, &#8220;Canada&#8221;);<br \/>\nreturn r;<\/p>\n<p>\u8fd4\u56de\u503c\uff1aThe rain in Canada<\/p>\n<p>search \u65b9\u6cd5<br \/>\n\u8fd4\u56de\u4e0e\u6b63\u5219\u8868\u8fbe\u5f0f\u67e5\u627e\u5185\u5bb9\u5339\u914d\u7684\u7b2c\u4e00\u4e2a\u5b50\u5b57\u7b26\u4e32\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>stringObj.search(rgExp)<\/p>\n<p>\u53c2\u6570\\<br \/>\nstringObj<br \/>\n\u5fc5\u9009\u9879\u3002\u8981\u5728\u5176\u4e0a\u8fdb\u884c\u67e5\u627e\u7684 String \u5bf9\u8c61\u6216\u5b57\u7b26\u4e32\u6587\u5b57\u3002<\/p>\n<p>rgExp<br \/>\n\u5fc5\u9009\u9879\u3002\u5305\u542b\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u548c\u53ef\u7528\u6807\u5fd7\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5bf9\u8c61\u3002<\/p>\n<p>\u8bf4\u660e<\/p>\n<p>search \u65b9\u6cd5\u6307\u660e\u662f\u5426\u5b58\u5728\u76f8\u5e94\u7684\u5339\u914d\u3002\u5982\u679c\u627e\u5230\u4e00\u4e2a\u5339\u914d\uff0csearch \u65b9\u6cd5\u5c06\u8fd4\u56de\u4e00\u4e2a\u6574\u6570\u503c\uff0c\u6307\u660e\u8fd9\u4e2a\u5339\u914d\u8ddd\u79bb\u5b57\u7b26\u4e32\u5f00\u59cb\u7684\u504f\u79fb\u4f4d\u7f6e\u3002\u5982\u679c\u6ca1\u6709\u627e\u5230\u5339\u914d\uff0c\u5219\u8fd4\u56de -1\u3002<\/p>\n<p>\u793a\u4f8b\\<br \/>\n\u4e0b\u9762\u7684\u793a\u4f8b\u6f14\u793a\u4e86 search \u65b9\u6cd5\u7684\u7528\u6cd5\u3002<\/p>\n<p>\u4ee3\u7801<br \/>\nfunction SearchDemo()<br \/>\n{<br \/>\nvar r, re; \/\/ \u58f0\u660e\u53d8\u91cf\u3002<br \/>\nvar s = &#8220;The rain in Spain falls mainly in the plain.&#8221;;<br \/>\nre = \/falls\/i; \/\/ \u521b\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u3002<br \/>\nr = s.search(re); \/\/ \u67e5\u627e\u5b57\u7b26\u4e32\u3002<br \/>\nreturn(r); \/\/ \u8fd4\u56de Boolean \u7ed3\u679c\u3002<br \/>\n}<\/p>\n<p>\u8fd4\u56de\u503c\uff1a18<\/p>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u8bed\u6cd5<br \/>\n\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5c31\u662f\u7531\u666e\u901a\u5b57\u7b26\uff08\u4f8b\u5982\u5b57\u7b26 a \u5230 z\uff09\u4ee5\u53ca\u7279\u6b8a\u5b57\u7b26\uff08\u79f0\u4e3a\u5143\u5b57\u7b26\uff09\u7ec4\u6210\u7684\u6587\u5b57\u6a21\u5f0f\u3002\u8be5\u6a21\u5f0f\u63cf\u8ff0\u5728\u67e5\u627e\u6587\u5b57\u4e3b\u4f53\u65f6\u5f85\u5339\u914d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u7b26\u4e32\u3002\u6b63\u5219\u8868\u8fbe\u5f0f\u4f5c\u4e3a\u4e00\u4e2a\u6a21\u677f\uff0c\u5c06\u67d0\u4e2a\u5b57\u7b26\u6a21\u5f0f\u4e0e\u6240\u641c\u7d22\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u5339\u914d\u3002<\/p>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e9b\u53ef\u80fd\u4f1a\u9047\u5230\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u793a\u4f8b\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\nJScript VBScript \u5339\u914d<br \/>\n\/^[ ]*$\/ &#8220;^[ ]*$&#8221; \u5339\u914d\u4e00\u4e2a\u7a7a\u767d\u884c\u3002<br \/>\n\/d{2}-d{5}\/ &#8220;d{2}-d{5}&#8221; \u9a8c\u8bc1\u4e00\u4e2aID \u53f7\u7801\u662f\u5426\u7531\u4e00\u4e2a2\u4f4d\u6570\u5b57\uff0c\u4e00\u4e2a\u8fde\u5b57\u7b26\u4ee5\u53ca\u4e00\u4e2a5\u4f4d\u6570\u5b57\u7ec4\u6210\u3002<br \/>\n\/&lt;(.*)&gt;.*&lt;\/1&gt;\/ &#8220;&lt;(.*)&gt;.*&lt;\/1&gt;&#8221; \u5339\u914d\u4e00\u4e2a HTML \u6807\u8bb0\u3002<\/p>\n<p>\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&amp;#39;n&amp;#39; \u5339\u914d\u5b57\u7b26 &#8220;n&#8221;\u3002&amp;#39;<br \/>\n&amp;#39; \u5339\u914d\u4e00\u4e2a\u6362\u884c\u7b26\u3002\u5e8f\u5217 &amp;#39;\\&amp;#39; \u5339\u914d &#8220;&#8221; \u800c &#8220;(&#8221; \u5219\u5339\u914d &#8220;(&#8220;\u3002<\/p>\n<p>^ \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 &amp;#39;<br \/>\n&amp;#39; \u6216 &amp;#39;<br \/>\n&amp;#39; \u4e4b\u540e\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>$ \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 &amp;#39;<br \/>\n&amp;#39; \u6216 &amp;#39;<br \/>\n&amp;#39; \u4e4b\u524d\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>* \u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u96f6\u6b21\u6216\u591a\u6b21\u3002\u4f8b\u5982\uff0czo* \u80fd\u5339\u914d &#8220;z&#8221; \u4ee5\u53ca &#8220;zoo&#8221;\u3002 * \u7b49\u4ef7\u4e8e{0,}\u3002<\/p>\n<p>+ \u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u4e00\u6b21\u6216\u591a\u6b21\u3002\u4f8b\u5982\uff0c&amp;#39;zo+&amp;#39; \u80fd\u5339\u914d &#8220;zo&#8221; \u4ee5\u53ca &#8220;zoo&#8221;\uff0c\u4f46\u4e0d\u80fd\u5339\u914d &#8220;z&#8221;\u3002+ \u7b49\u4ef7\u4e8e {1,}\u3002<\/p>\n<p>? \u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u96f6\u6b21\u6216\u4e00\u6b21\u3002\u4f8b\u5982\uff0c&#8221;do(es)?&#8221; \u53ef\u4ee5\u5339\u914d &#8220;do&#8221; \u6216 &#8220;does&#8221; \u4e2d\u7684&#8221;do&#8221; \u3002? \u7b49\u4ef7\u4e8e {0,1}\u3002<\/p>\n<p>{n} n \u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u3002\u5339\u914d\u786e\u5b9a\u7684 n \u6b21\u3002\u4f8b\u5982\uff0c&amp;#39;o{2}&amp;#39; \u4e0d\u80fd\u5339\u914d &#8220;Bob&#8221; \u4e2d\u7684 &amp;#39;o&amp;#39;\uff0c\u4f46\u662f\u80fd\u5339\u914d &#8220;food&#8221; \u4e2d\u7684\u4e24\u4e2a o\u3002<\/p>\n<p>{n,} n \u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u3002\u81f3\u5c11\u5339\u914dn \u6b21\u3002\u4f8b\u5982\uff0c&amp;#39;o{2,}&amp;#39; \u4e0d\u80fd\u5339\u914d &#8220;Bob&#8221; \u4e2d\u7684 &amp;#39;o&amp;#39;\uff0c\u4f46\u80fd\u5339\u914d &#8220;foooood&#8221; \u4e2d\u7684\u6240\u6709 o\u3002&amp;#39;o{1,}&amp;#39; \u7b49\u4ef7\u4e8e &amp;#39;o+&amp;#39;\u3002&amp;#39;o{0,}&amp;#39; \u5219\u7b49\u4ef7\u4e8e &amp;#39;o*&amp;#39;\u3002<\/p>\n<p>{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 &#8220;o{1,3}&#8221; \u5c06\u5339\u914d &#8220;fooooood&#8221; \u4e2d\u7684\u524d\u4e09\u4e2a o\u3002&amp;#39;o{0,1}&amp;#39; \u7b49\u4ef7\u4e8e &amp;#39;o?&amp;#39;\u3002\u8bf7\u6ce8\u610f\u5728\u9017\u53f7\u548c\u4e24\u4e2a\u6570\u4e4b\u95f4\u4e0d\u80fd\u6709\u7a7a\u683c\u3002<\/p>\n<p>? \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 &#8220;oooo&#8221;\uff0c&amp;#39;o+?&amp;#39; \u5c06\u5339\u914d\u5355\u4e2a &#8220;o&#8221;\uff0c\u800c &amp;#39;o+&amp;#39; \u5c06\u5339\u914d\u6240\u6709 &amp;#39;o&amp;#39;\u3002<\/p>\n<p>. \u5339\u914d\u9664 &#8221;<br \/>\n&#8221; \u4e4b\u5916\u7684\u4efb\u4f55\u5355\u4e2a\u5b57\u7b26\u3002\u8981\u5339\u914d\u5305\u62ec &amp;#39;<br \/>\n&amp;#39; \u5728\u5185\u7684\u4efb\u4f55\u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528\u8c61 &amp;#39;[.<br \/>\n]&amp;#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 $0\u2026$9 \u5c5e\u6027\u3002\u8981\u5339\u914d\u5706\u62ec\u53f7\u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528 &amp;#39;(&amp;#39; \u6216 &amp;#39;)&amp;#39;\u3002<\/p>\n<p>(?: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 &#8220;\u6216&#8221; \u5b57\u7b26 (|) \u6765\u7ec4\u5408\u4e00\u4e2a\u6a21\u5f0f\u7684\u5404\u4e2a\u90e8\u5206\u662f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff0c &amp;#39;industr(?:y|ies) \u5c31\u662f\u4e00\u4e2a\u6bd4 &amp;#39;industry|industries&amp;#39; \u66f4\u7b80\u7565\u7684\u8868\u8fbe\u5f0f\u3002<\/p>\n<p>(?=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 &amp;#39;Windows (?=95|98|NT|2000)&amp;#39; \u80fd\u5339\u914d &#8220;Windows 2000&#8221; \u4e2d\u7684 &#8220;Windows&#8221; \uff0c\u4f46\u4e0d\u80fd\u5339\u914d &#8220;Windows 3.1&#8221; \u4e2d\u7684 &#8220;Windows&#8221;\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<\/p>\n<p>(?!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&amp;#39;Windows (?!95|98|NT|2000)&amp;#39; \u80fd\u5339\u914d &#8220;Windows 3.1&#8221; \u4e2d\u7684 &#8220;Windows&#8221;\uff0c\u4f46\u4e0d\u80fd\u5339\u914d &#8220;Windows 2000&#8221; \u4e2d\u7684 &#8220;Windows&#8221;\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<\/p>\n<p>x|y \u5339\u914d x \u6216 y\u3002\u4f8b\u5982\uff0c&amp;#39;z|food&amp;#39; \u80fd\u5339\u914d &#8220;z&#8221; \u6216 &#8220;food&#8221;\u3002&amp;#39;(z|f)ood&amp;#39; \u5219\u5339\u914d &#8220;zood&#8221; \u6216 &#8220;food&#8221;\u3002<\/p>\n<p>[xyz] \u5b57\u7b26\u96c6\u5408\u3002\u5339\u914d\u6240\u5305\u542b\u7684\u4efb\u610f\u4e00\u4e2a\u5b57\u7b26\u3002\u4f8b\u5982\uff0c &amp;#39;[abc]&amp;#39; \u53ef\u4ee5\u5339\u914d &#8220;plain&#8221; \u4e2d\u7684 &amp;#39;a&amp;#39;\u3002<\/p>\n<p>[^xyz] \u8d1f\u503c\u5b57\u7b26\u96c6\u5408\u3002\u5339\u914d\u672a\u5305\u542b\u7684\u4efb\u610f\u5b57\u7b26\u3002\u4f8b\u5982\uff0c &amp;#39;[^abc]&amp;#39; \u53ef\u4ee5\u5339\u914d &#8220;plain&#8221; \u4e2d\u7684&amp;#39;p&amp;#39;\u3002<\/p>\n<p>[a-z] \u5b57\u7b26\u8303\u56f4\u3002\u5339\u914d\u6307\u5b9a\u8303\u56f4\u5185\u7684\u4efb\u610f\u5b57\u7b26\u3002\u4f8b\u5982\uff0c&amp;#39;[a-z]&amp;#39; \u53ef\u4ee5\u5339\u914d &amp;#39;a&amp;#39; \u5230 &amp;#39;z&amp;#39; \u8303\u56f4\u5185\u7684\u4efb\u610f\u5c0f\u5199\u5b57\u6bcd\u5b57\u7b26\u3002<\/p>\n<p>[^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&amp;#39;[^a-z]&amp;#39; \u53ef\u4ee5\u5339\u914d\u4efb\u4f55\u4e0d\u5728 &amp;#39;a&amp;#39; \u5230 &amp;#39;z&amp;#39; \u8303\u56f4\u5185\u7684\u4efb\u610f\u5b57\u7b26\u3002<\/p>\n<p>\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 &amp;#39;er\b&amp;#39; \u53ef\u4ee5\u5339\u914d&#8221;never&#8221; \u4e2d\u7684 &amp;#39;er&amp;#39;\uff0c\u4f46\u4e0d\u80fd\u5339\u914d &#8220;verb&#8221; \u4e2d\u7684 &amp;#39;er&amp;#39;\u3002<\/p>\n<p>B \u5339\u914d\u975e\u5355\u8bcd\u8fb9\u754c\u3002&amp;#39;erB&amp;#39; \u80fd\u5339\u914d &#8220;verb&#8221; \u4e2d\u7684 &amp;#39;er&amp;#39;\uff0c\u4f46\u4e0d\u80fd\u5339\u914d &#8220;never&#8221; \u4e2d\u7684 &amp;#39;er&amp;#39;\u3002<\/p>\n<p>cx \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 &amp;#39;c&amp;#39; \u5b57\u7b26\u3002<\/p>\n<p>d \u5339\u914d\u4e00\u4e2a\u6570\u5b57\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e [0-9]\u3002<\/p>\n<p>D \u5339\u914d\u4e00\u4e2a\u975e\u6570\u5b57\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e [^0-9]\u3002<\/p>\n<p>f \u5339\u914d\u4e00\u4e2a\u6362\u9875\u7b26\u3002\u7b49\u4ef7\u4e8e x0c \u548c cL\u3002<\/p>\n<p>\u5339\u914d\u4e00\u4e2a\u6362\u884c\u7b26\u3002\u7b49\u4ef7\u4e8e x0a \u548c cJ\u3002<\/p>\n<p>\u5339\u914d\u4e00\u4e2a\u56de\u8f66\u7b26\u3002\u7b49\u4ef7\u4e8e x0d \u548c cM\u3002<\/p>\n<p>s \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<\/p>\n<p>v]\u3002<\/p>\n<p>S \u5339\u914d\u4efb\u4f55\u975e\u7a7a\u767d\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e [^ f<\/p>\n<p>v]\u3002<\/p>\n<p>\u5339\u914d\u4e00\u4e2a\u5236\u8868\u7b26\u3002\u7b49\u4ef7\u4e8e x09 \u548c cI\u3002<\/p>\n<p>v \u5339\u914d\u4e00\u4e2a\u5782\u76f4\u5236\u8868\u7b26\u3002\u7b49\u4ef7\u4e8e x0b \u548c cK\u3002<\/p>\n<p>w \u5339\u914d\u5305\u62ec\u4e0b\u5212\u7ebf\u7684\u4efb\u4f55\u5355\u8bcd\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e&amp;#39;[A-Za-z0-9_]&amp;#39;\u3002<\/p>\n<p>W \u5339\u914d\u4efb\u4f55\u975e\u5355\u8bcd\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e &amp;#39;[^A-Za-z0-9_]&amp;#39;\u3002<\/p>\n<p>xn \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 &amp;#39;x41&amp;#39; \u5339\u914d &#8220;A&#8221;\u3002&amp;#39;x041&amp;#39; \u5219\u7b49\u4ef7\u4e8e &amp;#39;x04&amp;#39; &amp; &#8220;1&#8221;\u3002\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u53ef\u4ee5\u4f7f\u7528 ASCII \u7f16\u7801\u3002.<\/p>\n<p>um \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&amp;#39;(.)1&amp;#39; \u5339\u914d\u4e24\u4e2a\u8fde\u7eed\u7684\u76f8\u540c\u5b57\u7b26\u3002<\/p>\n<p>\u6807\u8bc6\u4e00\u4e2a\u516b\u8fdb\u5236\u8f6c\u4e49\u503c\u6216\u4e00\u4e2a\u540e\u5411\u5f15\u7528\u3002\u5982\u679c<br \/>\n\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<\/p>\n<p>m \u6807\u8bc6\u4e00\u4e2a\u516b\u8fdb\u5236\u8f6c\u4e49\u503c\u6216\u4e00\u4e2a\u540e\u5411\u5f15\u7528\u3002\u5982\u679c<br \/>\nm \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<br \/>\nm \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<br \/>\nm \u5c06\u5339\u914d\u516b\u8fdb\u5236\u8f6c\u4e49\u503c nm\u3002<\/p>\n<p>ml \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<\/p>\n<p>un \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<p>\u4f18\u5148\u6743\u987a\u5e8f<br \/>\n\u5728\u6784\u9020\u6b63\u5219\u8868\u8fbe\u5f0f\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u8c61\u6570\u5b66\u8868\u8fbe\u5f0f\u4e00\u6837\u6765\u6c42\u503c\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u53ef\u4ee5\u4ece\u5de6\u81f3\u53f3\u5e76\u6309\u7167\u4e00\u4e2a\u4f18\u5148\u6743\u987a\u5e8f\u6765\u6c42\u503c\u3002<\/p>\n<p>\u4e0b\u8868\u4ece\u6700\u9ad8\u4f18\u5148\u7ea7\u5230\u6700\u4f4e\u4f18\u5148\u7ea7\u5217\u51fa\u5404\u79cd\u6b63\u5219\u8868\u8fbe\u5f0f\u64cd\u4f5c\u7b26\u7684\u4f18\u5148\u6743\u987a\u5e8f\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\n\u64cd\u4f5c\u7b26 \u63cf\u8ff0<br \/>\n\u8f6c\u4e49\u7b26<br \/>\n(), (?:), (?=), [] \u5706\u62ec\u53f7\u548c\u65b9\u62ec\u53f7<br \/>\n*, +, ?, {n}, {n,}, {n,m} \u9650\u5b9a\u7b26<br \/>\n^, $, anymetacharacter \u4f4d\u7f6e\u548c\u987a\u5e8f<br \/>\n| \u201c\u6216\u201d\u64cd\u4f5c<\/p>\n<p>\u666e\u901a\u5b57\u7b26<\/p>\n<p>\u666e\u901a\u5b57\u7b26\u7531\u6240\u6709\u90a3\u4e9b\u672a\u663e\u5f0f\u6307\u5b9a\u4e3a\u5143\u5b57\u7b26\u7684\u6253\u5370\u548c\u975e\u6253\u5370\u5b57\u7b26\u7ec4\u6210\u3002\u8fd9\u5305\u62ec\u6240\u6709\u7684\u5927\u5199\u548c\u5c0f\u5199\u5b57\u6bcd\u5b57\u7b26\uff0c\u6240\u6709\u6570\u5b57\uff0c\u6240\u6709\u6807\u70b9\u7b26\u53f7\u4ee5\u53ca\u4e00\u4e9b\u7b26\u53f7\u3002<\/p>\n<p>\u6700\u7b80\u5355\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u4e2a\u5355\u72ec\u7684\u666e\u901a\u5b57\u7b26\uff0c\u53ef\u4ee5\u5339\u914d\u6240\u641c\u7d22\u5b57\u7b26\u4e32\u4e2d\u7684\u8be5\u5b57\u7b26\u672c\u8eab\u3002\u4f8b\u5982\uff0c\u5355\u5b57\u7b26\u6a21\u5f0f &amp;#39;A&amp;#39; \u53ef\u4ee5\u5339\u914d\u6240\u641c\u7d22\u5b57\u7b26\u4e32\u4e2d\u4efb\u4f55\u4f4d\u7f6e\u51fa\u73b0\u7684\u5b57\u6bcd &amp;#39;A&amp;#39;\u3002\u8fd9\u91cc\u6709\u4e00\u4e9b\u5355\u5b57\u7b26\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u7684\u793a\u4f8b\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\n\/a\/<br \/>\n\/7\/<br \/>\n\/M\/<\/p>\n<p>\u7b49\u4ef7\u7684 VBScript \u5355\u5b57\u7b26\u6b63\u5219\u8868\u8fbe\u5f0f\u4e3a\uff1a<\/p>\n<p>\u4ee3\u7801<br \/>\n&#8220;a&#8221;<br \/>\n&#8220;7&#8221;<br \/>\n&#8220;M&#8221;<\/p>\n<p>\u53ef\u4ee5\u5c06\u591a\u4e2a\u5355\u5b57\u7b26\u7ec4\u5408\u5728\u4e00\u8d77\u5f97\u5230\u4e00\u4e2a\u8f83\u5927\u7684\u8868\u8fbe\u5f0f\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u7684 JScript \u6b63\u5219\u8868\u8fbe\u5f0f\u4e0d\u662f\u522b\u7684\uff0c\u5c31\u662f\u901a\u8fc7\u7ec4\u5408\u5355\u5b57\u7b26\u8868\u8fbe\u5f0f &amp;#39;a&amp;#39;\u3001&amp;#39;7&amp;#39;\u4ee5\u53ca &amp;#39;M&amp;#39; \u6240\u521b\u5efa\u51fa\u6765\u7684\u4e00\u4e2a\u8868\u8fbe\u5f0f\u3002<\/p>\n<p>\/a7M\/<br \/>\n\u7b49\u4ef7\u7684 VBScript \u8868\u8fbe\u5f0f\u4e3a\uff1a<\/p>\n<p>&#8220;a7M&#8221;<br \/>\n\u8bf7\u6ce8\u610f\u8fd9\u91cc\u6ca1\u6709\u8fde\u63a5\u64cd\u4f5c\u7b26\u3002\u6240\u9700\u8981\u505a\u7684\u5c31\u662f\u5c06\u4e00\u4e2a\u5b57\u7b26\u653e\u5728\u4e86\u53e6\u4e00\u4e2a\u5b57\u7b26\u540e\u9762\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>JS\u7684\u6b63\u5219\u8868\u8fbe\u5f0f \/\/\u6821\u9a8c\u662f\u5426\u5168\u7531\u6570\u5b57\u7ec4\u6210 \u4ee3\u7801 function isDigi &hellip;<\/p>\n<p class=\"read-more\"><a href=\"http:\/\/zerobox.org\/notes\/112.html\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[116],"class_list":["post-112","post","type-post","status-publish","format-standard","hentry","tag-js"],"views":2564,"_links":{"self":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/comments?post=112"}],"version-history":[{"count":0,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/posts\/112\/revisions"}],"wp:attachment":[{"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/media?parent=112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/categories?post=112"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zerobox.org\/notes\/wp-json\/wp\/v2\/tags?post=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}