{"id":166014,"date":"2019-12-23T12:33:18","date_gmt":"2019-12-23T04:33:18","guid":{"rendered":"https:\/\/gulass.cn\/?p=166014"},"modified":"2019-12-06T08:34:16","modified_gmt":"2019-12-06T00:34:16","slug":"regular-expression-base","status":"publish","type":"post","link":"https:\/\/gulass.cn\/regular-expression-base.html","title":{"rendered":"\u6b63\u5219\u8868\u8fbe\u5f0f\u57fa\u7840"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6b63\u5219\u8868\u8fbe\u5f0f(regular expression)\u63cf\u8ff0\u4e86\u4e00\u79cd\u5b57\u7b26\u4e32\u5339\u914d\u7684\u6a21\u5f0f\uff08pattern\uff09\uff0c\u53ef\u4ee5\u7528\u6765\u68c0\u67e5\u4e00\u4e2a\u4e32\u662f\u5426\u542b\u6709\u67d0\u79cd\u5b50\u4e32\u3001\u5c06\u5339\u914d\u7684\u5b50\u4e32\u66ff\u6362\u6216\u8005\u4ece\u67d0\u4e2a\u4e32\u4e2d\u53d6\u51fa\u7b26\u5408\u67d0\u4e2a\u6761\u4ef6\u7684\u5b50\u4e32\u7b49\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u4f8b\u5982\uff1a<\/p>\n

    \n
  • runoo+b<\/span>\uff0c\u53ef\u4ee5\u5339\u914d runoob\u3001runooob\u3001runoooooob \u7b49\uff0c+ \u53f7\u4ee3\u8868\u524d\u9762\u7684\u5b57\u7b26\u5fc5\u987b\u81f3\u5c11\u51fa\u73b0\u4e00\u6b21\uff081\u6b21\u6216\u591a\u6b21\uff09\u3002<\/li>\n
  • runoo*b<\/span>\uff0c\u53ef\u4ee5\u5339\u914d runob\u3001runoob\u3001runoooooob \u7b49\uff0c* \u53f7\u4ee3\u8868\u5b57\u7b26\u53ef\u4ee5\u4e0d\u51fa\u73b0\uff0c\u4e5f\u53ef\u4ee5\u51fa\u73b0\u4e00\u6b21\u6216\u8005\u591a\u6b21\uff080\u6b21\u3001\u62161\u6b21\u3001\u6216\u591a\u6b21\uff09\u3002<\/li>\n
  • colou?r<\/span>\u00a0\u53ef\u4ee5\u5339\u914d color \u6216\u8005 colour\uff0c? \u95ee\u53f7\u4ee3\u8868\u524d\u9762\u7684\u5b57\u7b26\u6700\u591a\u53ea\u53ef\u4ee5\u51fa\u73b0\u4e00\u6b21\uff080\u6b21\u3001\u62161\u6b21\uff09\u3002<\/li>\n<\/ul>\n

    \u6784\u9020\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u65b9\u6cd5\u548c\u521b\u5efa\u6570\u5b66\u8868\u8fbe\u5f0f\u7684\u65b9\u6cd5\u4e00\u6837\u3002\u4e5f\u5c31\u662f\u7528\u591a\u79cd\u5143\u5b57\u7b26\u4e0e\u8fd0\u7b97\u7b26\u53ef\u4ee5\u5c06\u5c0f\u7684\u8868\u8fbe\u5f0f\u7ed3\u5408\u5728\u4e00\u8d77\u6765\u521b\u5efa\u66f4\u5927\u7684\u8868\u8fbe\u5f0f\u3002\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u7ec4\u4ef6\u53ef\u4ee5\u662f\u5355\u4e2a\u7684\u5b57\u7b26\u3001\u5b57\u7b26\u96c6\u5408\u3001\u5b57\u7b26\u8303\u56f4\u3001\u5b57\u7b26\u95f4\u7684\u9009\u62e9\u6216\u8005\u6240\u6709\u8fd9\u4e9b\u7ec4\u4ef6\u7684\u4efb\u610f\u7ec4\u5408\u3002<\/p>\n

    \u6b63\u5219\u8868\u8fbe\u5f0f\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\u6a21\u5f0f\u63cf\u8ff0\u5728\u641c\u7d22\u6587\u672c\u65f6\u8981\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


    \n
    \u666e\u901a\u5b57\u7b26 <\/strong><\/span><\/div>\n

    \u666e\u901a\u5b57\u7b26\u5305\u62ec\u6ca1\u6709\u663e\u5f0f\u6307\u5b9a\u4e3a\u5143\u5b57\u7b26\u7684\u6240\u6709\u53ef\u6253\u5370\u548c\u4e0d\u53ef\u6253\u5370\u5b57\u7b26\u3002\u8fd9\u5305\u62ec\u6240\u6709\u5927\u5199\u548c\u5c0f\u5199\u5b57\u6bcd\u3001\u6240\u6709\u6570\u5b57\u3001\u6240\u6709\u6807\u70b9\u7b26\u53f7\u548c\u4e00\u4e9b\u5176\u4ed6\u7b26\u53f7\u3002<\/p>\n


    \n
    \u975e\u6253\u5370\u5b57\u7b26 <\/strong><\/span><\/div>\n

    \u975e\u6253\u5370\u5b57\u7b26\u4e5f\u53ef\u4ee5\u662f\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u7ec4\u6210\u90e8\u5206\u3002\u4e0b\u8868\u5217\u51fa\u4e86\u8868\u793a\u975e\u6253\u5370\u5b57\u7b26\u7684\u8f6c\u4e49\u5e8f\u5217\uff1a<\/p>\n\n\n\n\n\n\n\n\n\n\n\n
    \u5b57\u7b26<\/th>\n\u63cf\u8ff0<\/th>\n<\/tr>\n
    \\cx<\/td>\n\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\u3002x \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 'c' \u5b57\u7b26\u3002<\/td>\n<\/tr>\n
    \\f<\/td>\n\u5339\u914d\u4e00\u4e2a\u6362\u9875\u7b26\u3002\u7b49\u4ef7\u4e8e \\x0c \u548c \\cL\u3002<\/td>\n<\/tr>\n
    \\n<\/td>\n\u5339\u914d\u4e00\u4e2a\u6362\u884c\u7b26\u3002\u7b49\u4ef7\u4e8e \\x0a \u548c \\cJ\u3002<\/td>\n<\/tr>\n
    \\r<\/td>\n\u5339\u914d\u4e00\u4e2a\u56de\u8f66\u7b26\u3002\u7b49\u4ef7\u4e8e \\x0d \u548c \\cM\u3002<\/td>\n<\/tr>\n
    \\s<\/td>\n\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\\n\\r\\t\\v]\u3002\u6ce8\u610f Unicode \u6b63\u5219\u8868\u8fbe\u5f0f\u4f1a\u5339\u914d\u5168\u89d2\u7a7a\u683c\u7b26\u3002<\/td>\n<\/tr>\n
    \\S<\/td>\n\u5339\u914d\u4efb\u4f55\u975e\u7a7a\u767d\u5b57\u7b26\u3002\u7b49\u4ef7\u4e8e [^ \\f\\n\\r\\t\\v]\u3002<\/td>\n<\/tr>\n
    \\t<\/td>\n\u5339\u914d\u4e00\u4e2a\u5236\u8868\u7b26\u3002\u7b49\u4ef7\u4e8e \\x09 \u548c \\cI\u3002<\/td>\n<\/tr>\n
    \\v<\/td>\n\u5339\u914d\u4e00\u4e2a\u5782\u76f4\u5236\u8868\u7b26\u3002\u7b49\u4ef7\u4e8e \\x0b \u548c \\cK\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
    \n
    \u7279\u6b8a\u5b57\u7b26 <\/strong><\/span><\/div>\n

    \u6240\u8c13\u7279\u6b8a\u5b57\u7b26\uff0c\u5c31\u662f\u4e00\u4e9b\u6709\u7279\u6b8a\u542b\u4e49\u7684\u5b57\u7b26\uff0c\u5982\u4e0a\u9762\u8bf4\u7684\u00a0runoo*b<\/span>\u00a0\u4e2d\u7684\u00a0*<\/span>\uff0c\u7b80\u5355\u7684\u8bf4\u5c31\u662f\u8868\u793a\u4efb\u4f55\u5b57\u7b26\u4e32\u7684\u610f\u601d\u3002\u5982\u679c\u8981\u67e5\u627e\u5b57\u7b26\u4e32\u4e2d\u7684\u00a0*<\/span>\u00a0\u7b26\u53f7\uff0c\u5219\u9700\u8981\u5bf9\u00a0*<\/span>\u00a0\u8fdb\u884c\u8f6c\u4e49\uff0c\u5373\u5728\u5176\u524d\u52a0\u4e00\u4e2a\u00a0\\<\/span>:\u00a0runo\\*ob<\/span>\u00a0\u5339\u914d runo*ob\u3002<\/p>\n

    \u8bb8\u591a\u5143\u5b57\u7b26\u8981\u6c42\u5728\u8bd5\u56fe\u5339\u914d\u5b83\u4eec\u65f6\u7279\u522b\u5bf9\u5f85\u3002\u82e5\u8981\u5339\u914d\u8fd9\u4e9b\u7279\u6b8a\u5b57\u7b26\uff0c\u5fc5\u987b\u9996\u5148\u4f7f\u5b57\u7b26\"\u8f6c\u4e49\"\uff0c\u5373\uff0c\u5c06\u53cd\u659c\u6760\u5b57\u7b26\\<\/span>\u00a0\u653e\u5728\u5b83\u4eec\u524d\u9762\u3002\u4e0b\u8868\u5217\u51fa\u4e86\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u7684\u7279\u6b8a\u5b57\u7b26\uff1a<\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
    \u7279\u522b\u5b57\u7b26<\/th>\n\u63cf\u8ff0<\/th>\n<\/tr>\n
    $<\/td>\n\u5339\u914d\u8f93\u5165\u5b57\u7b26\u4e32\u7684\u7ed3\u5c3e\u4f4d\u7f6e\u3002\u5982\u679c\u8bbe\u7f6e\u4e86 RegExp \u5bf9\u8c61\u7684 Multiline \u5c5e\u6027\uff0c\u5219 $ \u4e5f\u5339\u914d '\\n' \u6216 '\\r'\u3002\u8981\u5339\u914d $ \u5b57\u7b26\u672c\u8eab\uff0c\u8bf7\u4f7f\u7528 \\$\u3002<\/td>\n<\/tr>\n
    ( )<\/td>\n\u6807\u8bb0\u4e00\u4e2a\u5b50\u8868\u8fbe\u5f0f\u7684\u5f00\u59cb\u548c\u7ed3\u675f\u4f4d\u7f6e\u3002\u5b50\u8868\u8fbe\u5f0f\u53ef\u4ee5\u83b7\u53d6\u4f9b\u4ee5\u540e\u4f7f\u7528\u3002\u8981\u5339\u914d\u8fd9\u4e9b\u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528 \\( \u548c \\)\u3002<\/td>\n<\/tr>\n
    *<\/td>\n\u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u96f6\u6b21\u6216\u591a\u6b21\u3002\u8981\u5339\u914d * \u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528 \\*\u3002<\/td>\n<\/tr>\n
    +<\/td>\n\u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u4e00\u6b21\u6216\u591a\u6b21\u3002\u8981\u5339\u914d + \u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528 \\+\u3002<\/td>\n<\/tr>\n
    .<\/td>\n\u5339\u914d\u9664\u6362\u884c\u7b26 \\n \u4e4b\u5916\u7684\u4efb\u4f55\u5355\u5b57\u7b26\u3002\u8981\u5339\u914d . \uff0c\u8bf7\u4f7f\u7528 \\. \u3002<\/td>\n<\/tr>\n
    [<\/td>\n\u6807\u8bb0\u4e00\u4e2a\u4e2d\u62ec\u53f7\u8868\u8fbe\u5f0f\u7684\u5f00\u59cb\u3002\u8981\u5339\u914d [\uff0c\u8bf7\u4f7f\u7528 \\[\u3002<\/td>\n<\/tr>\n
    ?<\/td>\n\u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u96f6\u6b21\u6216\u4e00\u6b21\uff0c\u6216\u6307\u660e\u4e00\u4e2a\u975e\u8d2a\u5a6a\u9650\u5b9a\u7b26\u3002\u8981\u5339\u914d ? \u5b57\u7b26\uff0c\u8bf7\u4f7f\u7528 \\?\u3002<\/td>\n<\/tr>\n
    \\<\/td>\n\u5c06\u4e0b\u4e00\u4e2a\u5b57\u7b26\u6807\u8bb0\u4e3a\u6216\u7279\u6b8a\u5b57\u7b26\u3001\u6216\u539f\u4e49\u5b57\u7b26\u3001\u6216\u5411\u540e\u5f15\u7528\u3001\u6216\u516b\u8fdb\u5236\u8f6c\u4e49\u7b26\u3002\u4f8b\u5982\uff0c 'n' \u5339\u914d\u5b57\u7b26 'n'\u3002'\\n' \u5339\u914d\u6362\u884c\u7b26\u3002\u5e8f\u5217 '\\\\' \u5339\u914d \"\\\"\uff0c\u800c '\\(' \u5219\u5339\u914d \"(\"\u3002<\/td>\n<\/tr>\n
    ^<\/td>\n\u5339\u914d\u8f93\u5165\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\u4f4d\u7f6e\uff0c\u9664\u975e\u5728\u65b9\u62ec\u53f7\u8868\u8fbe\u5f0f\u4e2d\u4f7f\u7528\uff0c\u6b64\u65f6\u5b83\u8868\u793a\u4e0d\u63a5\u53d7\u8be5\u5b57\u7b26\u96c6\u5408\u3002\u8981\u5339\u914d ^ \u5b57\u7b26\u672c\u8eab\uff0c\u8bf7\u4f7f\u7528 \\^\u3002<\/td>\n<\/tr>\n
    {<\/td>\n\u6807\u8bb0\u9650\u5b9a\u7b26\u8868\u8fbe\u5f0f\u7684\u5f00\u59cb\u3002\u8981\u5339\u914d {\uff0c\u8bf7\u4f7f\u7528 \\{\u3002<\/td>\n<\/tr>\n
    |<\/td>\n\u6307\u660e\u4e24\u9879\u4e4b\u95f4\u7684\u4e00\u4e2a\u9009\u62e9\u3002\u8981\u5339\u914d |\uff0c\u8bf7\u4f7f\u7528 \\|\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
    \n
    \u9650\u5b9a\u7b26 <\/strong><\/span><\/div>\n

    \u9650\u5b9a\u7b26\u7528\u6765\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\u6709\u00a0*<\/span>\u00a0\u6216\u00a0+<\/span>\u00a0\u6216\u00a0?<\/span>\u00a0\u6216\u00a0{n}<\/span>\u00a0\u6216\u00a0{n,}<\/span>\u00a0\u6216\u00a0{n,m}<\/span>\u00a0\u51716\u79cd\u3002<\/p>\n

    \u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u9650\u5b9a\u7b26\u6709\uff1a<\/p>\n\n\n\n\n\n\n\n\n\n
    \u5b57\u7b26<\/th>\n\u63cf\u8ff0<\/th>\n<\/tr>\n
    *<\/td>\n\u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u96f6\u6b21\u6216\u591a\u6b21\u3002\u4f8b\u5982\uff0czo* \u80fd\u5339\u914d \"z\" \u4ee5\u53ca \"zoo\"\u3002* \u7b49\u4ef7\u4e8e{0,}\u3002<\/td>\n<\/tr>\n
    +<\/td>\n\u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u4e00\u6b21\u6216\u591a\u6b21\u3002\u4f8b\u5982\uff0c'zo+' \u80fd\u5339\u914d \"zo\" \u4ee5\u53ca \"zoo\"\uff0c\u4f46\u4e0d\u80fd\u5339\u914d \"z\"\u3002+ \u7b49\u4ef7\u4e8e {1,}\u3002<\/td>\n<\/tr>\n
    ?<\/td>\n\u5339\u914d\u524d\u9762\u7684\u5b50\u8868\u8fbe\u5f0f\u96f6\u6b21\u6216\u4e00\u6b21\u3002\u4f8b\u5982\uff0c\"do(es)?\" \u53ef\u4ee5\u5339\u914d \"do\" \u3001 \"does\" \u4e2d\u7684 \"does\" \u3001 \"doxy\" \u4e2d\u7684 \"do\" \u3002? \u7b49\u4ef7\u4e8e {0,1}\u3002<\/td>\n<\/tr>\n
    {n}<\/td>\nn \u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u3002\u5339\u914d\u786e\u5b9a\u7684 n \u6b21\u3002\u4f8b\u5982\uff0c'o{2}' \u4e0d\u80fd\u5339\u914d \"Bob\" \u4e2d\u7684 'o'\uff0c\u4f46\u662f\u80fd\u5339\u914d \"food\" \u4e2d\u7684\u4e24\u4e2a o\u3002<\/td>\n<\/tr>\n
    {n,}<\/td>\nn \u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u3002\u81f3\u5c11\u5339\u914dn \u6b21\u3002\u4f8b\u5982\uff0c'o{2,}' \u4e0d\u80fd\u5339\u914d \"Bob\" \u4e2d\u7684 'o'\uff0c\u4f46\u80fd\u5339\u914d \"foooood\" \u4e2d\u7684\u6240\u6709 o\u3002'o{1,}' \u7b49\u4ef7\u4e8e 'o+'\u3002'o{0,}' \u5219\u7b49\u4ef7\u4e8e 'o*'\u3002<\/td>\n<\/tr>\n
    {n,m}<\/td>\nm \u548c n \u5747\u4e3a\u975e\u8d1f\u6574\u6570\uff0c\u5176\u4e2dn <= m\u3002\u6700\u5c11\u5339\u914d n \u6b21\u4e14\u6700\u591a\u5339\u914d m \u6b21\u3002\u4f8b\u5982\uff0c\"o{1,3}\" \u5c06\u5339\u914d \"fooooood\" \u4e2d\u7684\u524d\u4e09\u4e2a o\u3002'o{0,1}' \u7b49\u4ef7\u4e8e 'o?'\u3002\u8bf7\u6ce8\u610f\u5728\u9017\u53f7\u548c\u4e24\u4e2a\u6570\u4e4b\u95f4\u4e0d\u80fd\u6709\u7a7a\u683c\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

    \u4ee5\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u4e00\u4e2a\u6b63\u6574\u6570\uff0c[1-9]<\/strong>\u8bbe\u7f6e\u7b2c\u4e00\u4e2a\u6570\u5b57\u4e0d\u662f 0\uff0c[0-9]*<\/span>\u00a0\u8868\u793a\u4efb\u610f\u591a\u4e2a\u6570\u5b57\uff1a<\/p>\n

    \/[1-9][0-9]*\/<\/span><\/pre>\n

    \u8bf7\u6ce8\u610f\uff0c\u9650\u5b9a\u7b26\u51fa\u73b0\u5728\u8303\u56f4\u8868\u8fbe\u5f0f\u4e4b\u540e\u3002\u56e0\u6b64\uff0c\u5b83\u5e94\u7528\u4e8e\u6574\u4e2a\u8303\u56f4\u8868\u8fbe\u5f0f\uff0c\u5728\u672c\u4f8b\u4e2d\uff0c\u53ea\u6307\u5b9a\u4ece 0 \u5230 9 \u7684\u6570\u5b57\uff08\u5305\u62ec 0 \u548c 9\uff09\u3002<\/p>\n

    \u8fd9\u91cc\u4e0d\u4f7f\u7528 + \u9650\u5b9a\u7b26\uff0c\u56e0\u4e3a\u5728\u7b2c\u4e8c\u4e2a\u4f4d\u7f6e\u6216\u540e\u9762\u7684\u4f4d\u7f6e\u4e0d\u4e00\u5b9a\u9700\u8981\u6709\u4e00\u4e2a\u6570\u5b57\u3002\u4e5f\u4e0d\u4f7f\u7528 ? \u5b57\u7b26\uff0c\u56e0\u4e3a\u4f7f\u7528 ? \u4f1a\u5c06\u6574\u6570\u9650\u5236\u5230\u53ea\u6709\u4e24\u4f4d\u6570\u3002<\/p>\n

    \u5982\u679c\u4f60\u60f3\u8bbe\u7f6e 0~99 \u7684\u4e24\u4f4d\u6570\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u8868\u8fbe\u5f0f\u6765\u81f3\u5c11\u6307\u5b9a\u4e00\u4f4d\u4f46\u81f3\u591a\u4e24\u4f4d\u6570\u5b57\u3002<\/p>\n

    \/[0-9]{1,2}\/<\/span><\/pre>\n

    \u4e0a\u9762\u7684\u8868\u8fbe\u5f0f\u7684\u7f3a\u70b9\u662f\uff0c\u53ea\u80fd\u5339\u914d\u4e24\u4f4d\u6570\u5b57\uff0c\u800c\u4e14\u53ef\u4ee5\u5339\u914d 0\u300100\u300101\u300110 99 \u7684\u7ae0\u8282\u7f16\u53f7\u4ecd\u53ea\u5339\u914d\u5f00\u5934\u4e24\u4f4d\u6570\u5b57\u3002<\/p>\n

    \u6539\u8fdb\u4e0b\uff0c\u5339\u914d 1~99 \u7684\u6b63\u6574\u6570\u8868\u8fbe\u5f0f\u5982\u4e0b\uff1a<\/p>\n

    \/[1-9][0-9]?\/<\/span><\/pre>\n

    \u6216<\/p>\n

    \/[1-9][0-9]{0,1}\/<\/span><\/pre>\n

    *\u3001+<\/span>\u00a0\u9650\u5b9a\u7b26\u90fd\u662f\u8d2a\u5a6a\u7684\uff0c\u56e0\u4e3a\u5b83\u4eec\u4f1a\u5c3d\u53ef\u80fd\u591a\u7684\u5339\u914d\u6587\u5b57\uff0c\u53ea\u6709\u5728\u5b83\u4eec\u7684\u540e\u9762\u52a0\u4e0a\u4e00\u4e2a?\u5c31\u53ef\u4ee5\u5b9e\u73b0\u975e\u8d2a\u5a6a\u6216\u6700\u5c0f\u5339\u914d\u3002<\/strong><\/p>\n

    \u4f8b\u5982\uff0c\u60a8\u53ef\u80fd\u641c\u7d22 HTML \u6587\u6863\uff0c\u4ee5\u67e5\u627e\u5728\u00a0h1<\/span>\u00a0\u6807\u7b7e\u5185\u7684\u5185\u5bb9\u3002HTML \u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n

    <h1><\/span>RUNOOB-\u83dc\u9e1f\u6559\u7a0b<\/span><\/h1><\/span><\/pre>\n

    \u8d2a\u5a6a\uff1a<\/strong>\u4e0b\u9762\u7684\u8868\u8fbe\u5f0f\u5339\u914d\u4ece\u5f00\u59cb\u5c0f\u4e8e\u7b26\u53f7 (<) \u5230\u5173\u95ed h1 \u6807\u8bb0\u7684\u5927\u4e8e\u7b26\u53f7 (>) \u4e4b\u95f4\u7684\u6240\u6709\u5185\u5bb9\u3002<\/p>\n

    \/<.*>\/<\/span><\/pre>\n

    \u975e\u8d2a\u5a6a\uff1a<\/strong>\u5982\u679c\u60a8\u53ea\u9700\u8981\u5339\u914d\u5f00\u59cb\u548c\u7ed3\u675f h1 \u6807\u7b7e\uff0c\u4e0b\u9762\u7684\u975e\u8d2a\u5a6a\u8868\u8fbe\u5f0f\u53ea\u5339\u914d <h1>\u3002<\/p>\n

    \/<.*?>\/<\/span><\/pre>\n

    \u4e5f\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\u6765\u5339\u914d h1 \u6807\u7b7e\uff0c\u8868\u8fbe\u5f0f\u5219\u662f\uff1a<\/p>\n

    \/<\\w+?>\/<\/span><\/pre>\n

    \u901a\u8fc7\u5728\u00a0*<\/span>\u3001+<\/span>\u00a0\u6216\u00a0?<\/span>\u00a0\u9650\u5b9a\u7b26\u4e4b\u540e\u653e\u7f6e\u00a0?<\/span>\uff0c\u8be5\u8868\u8fbe\u5f0f\u4ece\"\u8d2a\u5a6a\"\u8868\u8fbe\u5f0f\u8f6c\u6362\u4e3a\"\u975e\u8d2a\u5a6a\"\u8868\u8fbe\u5f0f\u6216\u8005\u6700\u5c0f\u5339\u914d\u3002<\/p>\n


    \n
    \u5b9a\u4f4d\u7b26 <\/strong><\/span><\/div>\n

    \u5b9a\u4f4d\u7b26\u4f7f\u60a8\u80fd\u591f\u5c06\u6b63\u5219\u8868\u8fbe\u5f0f\u56fa\u5b9a\u5230\u884c\u9996\u6216\u884c\u5c3e\u3002\u5b83\u4eec\u8fd8\u4f7f\u60a8\u80fd\u591f\u521b\u5efa\u8fd9\u6837\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u8fd9\u4e9b\u6b63\u5219\u8868\u8fbe\u5f0f\u51fa\u73b0\u5728\u4e00\u4e2a\u5355\u8bcd\u5185\u3001\u5728\u4e00\u4e2a\u5355\u8bcd\u7684\u5f00\u5934\u6216\u8005\u4e00\u4e2a\u5355\u8bcd\u7684\u7ed3\u5c3e\u3002<\/p>\n

    \u5b9a\u4f4d\u7b26\u7528\u6765\u63cf\u8ff0\u5b57\u7b26\u4e32\u6216\u5355\u8bcd\u7684\u8fb9\u754c\uff0c^<\/span>\u00a0\u548c\u00a0$<\/span>\u00a0\u5206\u522b\u6307\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\u4e0e\u7ed3\u675f\uff0c\\b<\/span>\u00a0\u63cf\u8ff0\u5355\u8bcd\u7684\u524d\u6216\u540e\u8fb9\u754c\uff0c\\B<\/span>\u00a0\u8868\u793a\u975e\u5355\u8bcd\u8fb9\u754c\u3002<\/p>\n

    \u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5b9a\u4f4d\u7b26\u6709\uff1a<\/p>\n\n\n\n\n\n\n\n
    \u5b57\u7b26<\/th>\n\u63cf\u8ff0<\/th>\n<\/tr>\n
    ^<\/td>\n\u5339\u914d\u8f93\u5165\u5b57\u7b26\u4e32\u5f00\u59cb\u7684\u4f4d\u7f6e\u3002\u5982\u679c\u8bbe\u7f6e\u4e86 RegExp \u5bf9\u8c61\u7684 Multiline \u5c5e\u6027\uff0c^ \u8fd8\u4f1a\u4e0e \\n \u6216 \\r \u4e4b\u540e\u7684\u4f4d\u7f6e\u5339\u914d\u3002<\/td>\n<\/tr>\n
    $<\/td>\n\u5339\u914d\u8f93\u5165\u5b57\u7b26\u4e32\u7ed3\u5c3e\u7684\u4f4d\u7f6e\u3002\u5982\u679c\u8bbe\u7f6e\u4e86 RegExp \u5bf9\u8c61\u7684 Multiline \u5c5e\u6027\uff0c$ \u8fd8\u4f1a\u4e0e \\n \u6216 \\r \u4e4b\u524d\u7684\u4f4d\u7f6e\u5339\u914d\u3002<\/td>\n<\/tr>\n
    \\b<\/td>\n\u5339\u914d\u4e00\u4e2a\u5355\u8bcd\u8fb9\u754c\uff0c\u5373\u5b57\u4e0e\u7a7a\u683c\u95f4\u7684\u4f4d\u7f6e\u3002<\/td>\n<\/tr>\n
    \\B<\/td>\n\u975e\u5355\u8bcd\u8fb9\u754c\u5339\u914d\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

    \u6ce8\u610f<\/strong>\uff1a\u4e0d\u80fd\u5c06\u9650\u5b9a\u7b26\u4e0e\u5b9a\u4f4d\u7b26\u4e00\u8d77\u4f7f\u7528\u3002\u7531\u4e8e\u5728\u7d27\u9760\u6362\u884c\u6216\u8005\u5355\u8bcd\u8fb9\u754c\u7684\u524d\u9762\u6216\u540e\u9762\u4e0d\u80fd\u6709\u4e00\u4e2a\u4ee5\u4e0a\u4f4d\u7f6e\uff0c\u56e0\u6b64\u4e0d\u5141\u8bb8\u8bf8\u5982\u00a0^*<\/span>\u00a0\u4e4b\u7c7b\u7684\u8868\u8fbe\u5f0f\u3002<\/p>\n

    \u82e5\u8981\u5339\u914d\u4e00\u884c\u6587\u672c\u5f00\u59cb\u5904\u7684\u6587\u672c\uff0c\u8bf7\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5f00\u59cb\u4f7f\u7528\u00a0^<\/span>\u00a0\u5b57\u7b26\u3002\u4e0d\u8981\u5c06\u00a0^<\/span>\u00a0\u7684\u8fd9\u79cd\u7528\u6cd5\u4e0e\u4e2d\u62ec\u53f7\u8868\u8fbe\u5f0f\u5185\u7684\u7528\u6cd5\u6df7\u6dc6\u3002<\/p>\n

    \u82e5\u8981\u5339\u914d\u4e00\u884c\u6587\u672c\u7684\u7ed3\u675f\u5904\u7684\u6587\u672c\uff0c\u8bf7\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u7ed3\u675f\u5904\u4f7f\u7528\u00a0$<\/span>\u00a0\u5b57\u7b26\u3002<\/p>\n

    \u82e5\u8981\u5728\u641c\u7d22\u7ae0\u8282\u6807\u9898\u65f6\u4f7f\u7528\u5b9a\u4f4d\u70b9\uff0c\u4e0b\u9762\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u4e00\u4e2a\u7ae0\u8282\u6807\u9898\uff0c\u8be5\u6807\u9898\u53ea\u5305\u542b\u4e24\u4e2a\u5c3e\u968f\u6570\u5b57\uff0c\u5e76\u4e14\u51fa\u73b0\u5728\u884c\u9996\uff1a<\/p>\n

    \/^Chapter [1-9][0-9]{0,1}\/<\/span><\/pre>\n

    \u771f\u6b63\u7684\u7ae0\u8282\u6807\u9898\u4e0d\u4ec5\u51fa\u73b0\u884c\u7684\u5f00\u59cb\u5904\uff0c\u800c\u4e14\u5b83\u8fd8\u662f\u8be5\u884c\u4e2d\u4ec5\u6709\u7684\u6587\u672c\u3002\u5b83\u5373\u51fa\u73b0\u5728\u884c\u9996\u53c8\u51fa\u73b0\u5728\u540c\u4e00\u884c\u7684\u7ed3\u5c3e\u3002\u4e0b\u9762\u7684\u8868\u8fbe\u5f0f\u80fd\u786e\u4fdd\u6307\u5b9a\u7684\u5339\u914d\u53ea\u5339\u914d\u7ae0\u8282\u800c\u4e0d\u5339\u914d\u4ea4\u53c9\u5f15\u7528\u3002\u901a\u8fc7\u521b\u5efa\u53ea\u5339\u914d\u4e00\u884c\u6587\u672c\u7684\u5f00\u59cb\u548c\u7ed3\u5c3e\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5c31\u53ef\u505a\u5230\u8fd9\u4e00\u70b9\u3002<\/p>\n

    \/^Chapter [1-9][0-9]{0,1}$\/<\/span><\/pre>\n

    \u5339\u914d\u5355\u8bcd\u8fb9\u754c\u7a0d\u6709\u4e0d\u540c\uff0c\u4f46\u5411\u6b63\u5219\u8868\u8fbe\u5f0f\u6dfb\u52a0\u4e86\u5f88\u91cd\u8981\u7684\u80fd\u529b\u3002\u5355\u8bcd\u8fb9\u754c\u662f\u5355\u8bcd\u548c\u7a7a\u683c\u4e4b\u95f4\u7684\u4f4d\u7f6e\u3002\u975e\u5355\u8bcd\u8fb9\u754c\u662f\u4efb\u4f55\u5176\u4ed6\u4f4d\u7f6e\u3002\u4e0b\u9762\u7684\u8868\u8fbe\u5f0f\u5339\u914d\u5355\u8bcd Chapter \u7684\u5f00\u5934\u4e09\u4e2a\u5b57\u7b26\uff0c\u56e0\u4e3a\u8fd9\u4e09\u4e2a\u5b57\u7b26\u51fa\u73b0\u5728\u5355\u8bcd\u8fb9\u754c\u540e\u9762\uff1a<\/p>\n

    \/\\bCha\/<\/span><\/pre>\n

    \\b<\/span>\u00a0\u5b57\u7b26\u7684\u4f4d\u7f6e\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u5982\u679c\u5b83\u4f4d\u4e8e\u8981\u5339\u914d\u7684\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\uff0c\u5b83\u5728\u5355\u8bcd\u7684\u5f00\u59cb\u5904\u67e5\u627e\u5339\u914d\u9879\u3002\u5982\u679c\u5b83\u4f4d\u4e8e\u5b57\u7b26\u4e32\u7684\u7ed3\u5c3e\uff0c\u5b83\u5728\u5355\u8bcd\u7684\u7ed3\u5c3e\u5904\u67e5\u627e\u5339\u914d\u9879\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u7684\u8868\u8fbe\u5f0f\u5339\u914d\u5355\u8bcd Chapter \u4e2d\u7684\u5b57\u7b26\u4e32 ter\uff0c\u56e0\u4e3a\u5b83\u51fa\u73b0\u5728\u5355\u8bcd\u8fb9\u754c\u7684\u524d\u9762\uff1a<\/p>\n

    \/ter\\b\/<\/span><\/pre>\n

    \u4e0b\u9762\u7684\u8868\u8fbe\u5f0f\u5339\u914d Chapter \u4e2d\u7684\u5b57\u7b26\u4e32 apt\uff0c\u4f46\u4e0d\u5339\u914d aptitude \u4e2d\u7684\u5b57\u7b26\u4e32 apt\uff1a<\/p>\n

    \/\\Bapt\/<\/span><\/pre>\n

    \u5b57\u7b26\u4e32 apt \u51fa\u73b0\u5728\u5355\u8bcd Chapter \u4e2d\u7684\u975e\u5355\u8bcd\u8fb9\u754c\u5904\uff0c\u4f46\u51fa\u73b0\u5728\u5355\u8bcd aptitude \u4e2d\u7684\u5355\u8bcd\u8fb9\u754c\u5904\u3002\u5bf9\u4e8e\u00a0\\B<\/span>\u00a0\u975e\u5355\u8bcd\u8fb9\u754c\u8fd0\u7b97\u7b26\uff0c\u4f4d\u7f6e\u5e76\u4e0d\u91cd\u8981\uff0c\u56e0\u4e3a\u5339\u914d\u4e0d\u5173\u5fc3\u7a76\u7adf\u662f\u5355\u8bcd\u7684\u5f00\u5934\u8fd8\u662f\u7ed3\u5c3e\u3002<\/p>\n


    \n
    \u9009\u62e9 <\/strong><\/span><\/div>\n

    \u7528\u5706\u62ec\u53f7\u5c06\u6240\u6709\u9009\u62e9\u9879\u62ec\u8d77\u6765\uff0c\u76f8\u90bb\u7684\u9009\u62e9\u9879\u4e4b\u95f4\u7528|\u5206\u9694\u3002\u4f46\u7528\u5706\u62ec\u53f7\u4f1a\u6709\u4e00\u4e2a\u526f\u4f5c\u7528\uff0c\u4f7f\u76f8\u5173\u7684\u5339\u914d\u4f1a\u88ab\u7f13\u5b58\uff0c\u6b64\u65f6\u53ef\u7528?:\u653e\u5728\u7b2c\u4e00\u4e2a\u9009\u9879\u524d\u6765\u6d88\u9664\u8fd9\u79cd\u526f\u4f5c\u7528\u3002<\/p>\n

    \u5176\u4e2d\u00a0?:<\/span>\u00a0\u662f\u975e\u6355\u83b7\u5143\u4e4b\u4e00\uff0c\u8fd8\u6709\u4e24\u4e2a\u975e\u6355\u83b7\u5143\u662f\u00a0?=<\/span>\u00a0\u548c\u00a0?!<\/span>\uff0c\u8fd9\u4e24\u4e2a\u8fd8\u6709\u66f4\u591a\u7684\u542b\u4e49\uff0c\u524d\u8005\u4e3a\u6b63\u5411\u9884\u67e5\uff0c\u5728\u4efb\u4f55\u5f00\u59cb\u5339\u914d\u5706\u62ec\u53f7\u5185\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u7684\u4f4d\u7f6e\u6765\u5339\u914d\u641c\u7d22\u5b57\u7b26\u4e32\uff0c\u540e\u8005\u4e3a\u8d1f\u5411\u9884\u67e5\uff0c\u5728\u4efb\u4f55\u5f00\u59cb\u4e0d\u5339\u914d\u8be5\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u7684\u4f4d\u7f6e\u6765\u5339\u914d\u641c\u7d22\u5b57\u7b26\u4e32\u3002<\/p>\n


    \n
    \u53cd\u5411\u5f15\u7528 <\/strong><\/span><\/div>\n

    \u5bf9\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u6216\u90e8\u5206\u6a21\u5f0f\u4e24\u8fb9\u6dfb\u52a0\u5706\u62ec\u53f7\u5c06\u5bfc\u81f4\u76f8\u5173\u5339\u914d\u5b58\u50a8\u5230\u4e00\u4e2a\u4e34\u65f6\u7f13\u51b2\u533a\u4e2d\uff0c\u6240\u6355\u83b7\u7684\u6bcf\u4e2a\u5b50\u5339\u914d\u90fd\u6309\u7167\u5728\u6b63\u5219\u8868\u8fbe\u5f0f\u6a21\u5f0f\u4e2d\u4ece\u5de6\u5230\u53f3\u51fa\u73b0\u7684\u987a\u5e8f\u5b58\u50a8\u3002\u7f13\u51b2\u533a\u7f16\u53f7\u4ece 1 \u5f00\u59cb\uff0c\u6700\u591a\u53ef\u5b58\u50a8 99 \u4e2a\u6355\u83b7\u7684\u5b50\u8868\u8fbe\u5f0f\u3002\u6bcf\u4e2a\u7f13\u51b2\u533a\u90fd\u53ef\u4ee5\u4f7f\u7528\u00a0\\n<\/span>\u00a0\u8bbf\u95ee\uff0c\u5176\u4e2d n \u4e3a\u4e00\u4e2a\u6807\u8bc6\u7279\u5b9a\u7f13\u51b2\u533a\u7684\u4e00\u4f4d\u6216\u4e24\u4f4d\u5341\u8fdb\u5236\u6570\u3002<\/p>\n

    \u53ef\u4ee5\u4f7f\u7528\u975e\u6355\u83b7\u5143\u5b57\u7b26\u00a0?:<\/span>\u3001?=<\/span>\u00a0\u6216\u00a0?!<\/span>\u00a0\u6765\u91cd\u5199\u6355\u83b7\uff0c\u5ffd\u7565\u5bf9\u76f8\u5173\u5339\u914d\u7684\u4fdd\u5b58\u3002<\/p>\n

    \u53cd\u5411\u5f15\u7528\u7684\u6700\u7b80\u5355\u7684\u3001\u6700\u6709\u7528\u7684\u5e94\u7528\u4e4b\u4e00\uff0c\u662f\u63d0\u4f9b\u67e5\u627e\u6587\u672c\u4e2d\u4e24\u4e2a\u76f8\u540c\u7684\u76f8\u90bb\u5355\u8bcd\u7684\u5339\u914d\u9879\u7684\u80fd\u529b\u3002\u4ee5\u4e0b\u9762\u7684\u53e5\u5b50\u4e3a\u4f8b\uff1a<\/p>\n

    Is<\/span> is<\/span> the cost of of gasoline going up up<\/span>?<\/span><\/pre>\n

    \u4e0a\u9762\u7684\u53e5\u5b50\u5f88\u663e\u7136\u6709\u591a\u4e2a\u91cd\u590d\u7684\u5355\u8bcd\u3002\u5982\u679c\u80fd\u8bbe\u8ba1\u4e00\u79cd\u65b9\u6cd5\u5b9a\u4f4d\u8be5\u53e5\u5b50\uff0c\u800c\u4e0d\u5fc5\u67e5\u627e\u6bcf\u4e2a\u5355\u8bcd\u7684\u91cd\u590d\u51fa\u73b0\uff0c\u90a3\u8be5\u6709\u591a\u597d\u3002\u4e0b\u9762\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u4f7f\u7528\u5355\u4e2a\u5b50\u8868\u8fbe\u5f0f\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\uff1a<\/p>\n

    \n
    \u5b9e\u4f8b <\/strong><\/span><\/div>\n

    \u67e5\u627e\u91cd\u590d\u7684\u5355\u8bcd\uff1a<\/p>\n

    \n
    var<\/span> str<\/span> = <\/span>\"<\/span>Is is the cost of of gasoline going up up<\/span>\"<\/span>; <\/span>var<\/span> patt1<\/span> = \/\\<\/span>b<\/span>(<\/span>[<\/span>a<\/span>-<\/span>z<\/span>]<\/span>+<\/span>)<\/span> \\<\/span>1<\/span>\\<\/span>b<\/span>\/<\/span>ig<\/span>; <\/span>document<\/span>.<\/span>write<\/span>(<\/span>str<\/span>.<\/span>match<\/span>(<\/span>patt1<\/span>)<\/span>)<\/span>;<\/span><\/div>\n<\/div>\n<\/div>\n

    \u6355\u83b7\u7684\u8868\u8fbe\u5f0f\uff0c\u6b63\u5982\u00a0[a-z]+<\/span>\u00a0\u6307\u5b9a\u7684\uff0c\u5305\u62ec\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\u3002\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u7b2c\u4e8c\u90e8\u5206\u662f\u5bf9\u4ee5\u524d\u6355\u83b7\u7684\u5b50\u5339\u914d\u9879\u7684\u5f15\u7528\uff0c\u5373\uff0c\u5355\u8bcd\u7684\u7b2c\u4e8c\u4e2a\u5339\u914d\u9879\u6b63\u597d\u7531\u62ec\u53f7\u8868\u8fbe\u5f0f\u5339\u914d\u3002\\1<\/span>\u00a0\u6307\u5b9a\u7b2c\u4e00\u4e2a\u5b50\u5339\u914d\u9879\u3002<\/p>\n

    \u5355\u8bcd\u8fb9\u754c\u5143\u5b57\u7b26\u786e\u4fdd\u53ea\u68c0\u6d4b\u6574\u4e2a\u5355\u8bcd\u3002\u5426\u5219\uff0c\u8bf8\u5982 \"is issued\" \u6216 \"this is\" \u4e4b\u7c7b\u7684\u8bcd\u7ec4\u5c06\u4e0d\u80fd\u6b63\u786e\u5730\u88ab\u6b64\u8868\u8fbe\u5f0f\u8bc6\u522b\u3002<\/p>\n

    \u6b63\u5219\u8868\u8fbe\u5f0f\u540e\u9762\u7684\u5168\u5c40\u6807\u8bb0\u00a0g<\/span>\u00a0\u6307\u5b9a\u5c06\u8be5\u8868\u8fbe\u5f0f\u5e94\u7528\u5230\u8f93\u5165\u5b57\u7b26\u4e32\u4e2d\u80fd\u591f\u67e5\u627e\u5230\u7684\u5c3d\u53ef\u80fd\u591a\u7684\u5339\u914d\u3002<\/p>\n

    \u8868\u8fbe\u5f0f\u7684\u7ed3\u5c3e\u5904\u7684\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u00a0i<\/span>\u00a0\u6807\u8bb0\u6307\u5b9a\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/p>\n

    \u591a\u884c\u6807\u8bb0\u6307\u5b9a\u6362\u884c\u7b26\u7684\u4e24\u8fb9\u53ef\u80fd\u51fa\u73b0\u6f5c\u5728\u7684\u5339\u914d\u3002<\/p>\n

    \u53cd\u5411\u5f15\u7528\u8fd8\u53ef\u4ee5\u5c06\u901a\u7528\u8d44\u6e90\u6307\u793a\u7b26 (URI) \u5206\u89e3\u4e3a\u5176\u7ec4\u4ef6\u3002\u5047\u5b9a\u60a8\u60f3\u5c06\u4e0b\u9762\u7684 URI \u5206\u89e3\u4e3a\u534f\u8bae\uff08ftp\u3001http \u7b49\u7b49\uff09\u3001\u57df\u5730\u5740\u548c\u9875\/\u8def\u5f84\uff1a<\/p>\n

    http<\/span>:<\/span>\/\/www.runoob.com:80\/html\/html-tutorial.html<\/span><\/pre>\n

    \u4e0b\u9762\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u63d0\u4f9b\u8be5\u529f\u80fd\uff1a<\/p>\n

    \n
    \u5b9e\u4f8b <\/strong><\/span><\/div>\n

    \u8f93\u51fa\u6240\u6709\u5339\u914d\u7684\u6570\u636e\uff1a<\/p>\n

    \n
    var<\/span> str<\/span> = <\/span>\"<\/span>http:\/\/www.runoob.com:80\/html\/html-tutorial.html<\/span>\"<\/span>; <\/span>var<\/span> patt1<\/span> = \/<\/span>(<\/span>\\<\/span>w<\/span>+<\/span>)<\/span>:\\\/\\\/<\/span>(<\/span>[<\/span>^\/:<\/span>]<\/span>+<\/span>)<\/span>(<\/span>:\\<\/span>d<\/span>*<\/span>)<\/span>?<\/span>(<\/span>[<\/span>^# <\/span>]<\/span>*<\/span>)<\/span>\/; <\/span>arr<\/span> = <\/span>str<\/span>.<\/span>match<\/span>(<\/span>patt1<\/span>)<\/span>; <\/span>for<\/span> (<\/span>var<\/span> i<\/span> = <\/span>0<\/span>; <\/span>i<\/span> < <\/span>arr<\/span>.<\/span>length<\/span> ; <\/span>i<\/span>++<\/span>)<\/span> {<\/span> document<\/span>.<\/span>write<\/span>(<\/span>arr<\/span>[<\/span>i<\/span>]<\/span>)<\/span>; <\/span>document<\/span>.<\/span>write<\/span>(<\/span>\"<\/span><br><\/span>\"<\/span>)<\/span>; <\/span>}<\/span><\/div>\n<\/div>\n<\/div>\n

    \u7b2c\u4e09\u884c\u4ee3\u7801\u00a0str.match(patt1)<\/span>\u00a0\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\uff0c\u5b9e\u4f8b\u4e2d\u7684\u6570\u7ec4\u5305\u542b 5 \u4e2a\u5143\u7d20\uff0c\u7d22\u5f15 0 \u5bf9\u5e94\u7684\u662f\u6574\u4e2a\u5b57\u7b26\u4e32\uff0c\u7d22\u5f15 1 \u5bf9\u5e94\u7b2c\u4e00\u4e2a\u5339\u914d\u7b26\uff08\u62ec\u53f7\u5185\uff09\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002<\/p>\n

    \u7b2c\u4e00\u4e2a\u62ec\u53f7\u5b50\u8868\u8fbe\u5f0f\u6355\u83b7 Web \u5730\u5740\u7684\u534f\u8bae\u90e8\u5206\u3002\u8be5\u5b50\u8868\u8fbe\u5f0f\u5339\u914d\u5728\u5192\u53f7\u548c\u4e24\u4e2a\u6b63\u659c\u6760\u524d\u9762\u7684\u4efb\u4f55\u5355\u8bcd\u3002<\/p>\n

    \u7b2c\u4e8c\u4e2a\u62ec\u53f7\u5b50\u8868\u8fbe\u5f0f\u6355\u83b7\u5730\u5740\u7684\u57df\u5730\u5740\u90e8\u5206\u3002\u5b50\u8868\u8fbe\u5f0f\u5339\u914d\u00a0:<\/span>\u00a0\u548c\u00a0\/<\/span>\u00a0\u4e4b\u540e\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u7b26\u3002<\/p>\n

    \u7b2c\u4e09\u4e2a\u62ec\u53f7\u5b50\u8868\u8fbe\u5f0f\u6355\u83b7\u7aef\u53e3\u53f7\uff08\u5982\u679c\u6307\u5b9a\u4e86\u7684\u8bdd\uff09\u3002\u8be5\u5b50\u8868\u8fbe\u5f0f\u5339\u914d\u5192\u53f7\u540e\u9762\u7684\u96f6\u4e2a\u6216\u591a\u4e2a\u6570\u5b57\u3002\u53ea\u80fd\u91cd\u590d\u4e00\u6b21\u8be5\u5b50\u8868\u8fbe\u5f0f\u3002<\/p>\n

    \u6700\u540e\uff0c\u7b2c\u56db\u4e2a\u62ec\u53f7\u5b50\u8868\u8fbe\u5f0f\u6355\u83b7 Web \u5730\u5740\u6307\u5b9a\u7684\u8def\u5f84\u548c \/ \u6216\u9875\u4fe1\u606f\u3002\u8be5\u5b50\u8868\u8fbe\u5f0f\u80fd\u5339\u914d\u4e0d\u5305\u62ec # \u6216\u7a7a\u683c\u5b57\u7b26\u7684\u4efb\u4f55\u5b57\u7b26\u5e8f\u5217\u3002<\/p>\n

    \u5c06\u6b63\u5219\u8868\u8fbe\u5f0f\u5e94\u7528\u5230\u4e0a\u9762\u7684 URI\uff0c\u5404\u5b50\u5339\u914d\u9879\u5305\u542b\u4e0b\u9762\u7684\u5185\u5bb9\uff1a<\/p>\n

      \n
    • \u7b2c\u4e00\u4e2a\u62ec\u53f7\u5b50\u8868\u8fbe\u5f0f\u5305\u542b\u00a0http<\/strong><\/li>\n
    • \u7b2c\u4e8c\u4e2a\u62ec\u53f7\u5b50\u8868\u8fbe\u5f0f\u5305\u542b\u00a0www.runoob.com<\/strong><\/li>\n
    • \u7b2c\u4e09\u4e2a\u62ec\u53f7\u5b50\u8868\u8fbe\u5f0f\u5305\u542b\u00a0:80<\/strong><\/li>\n
    • \u7b2c\u56db\u4e2a\u62ec\u53f7\u5b50\u8868\u8fbe\u5f0f\u5305\u542b\u00a0\/html\/html-tutorial.html<\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"

      \u4f8b\u5982\uff1a runoo+b\uff0c\u53ef\u4ee5\u5339\u914d runoob\u3001runooob\u3001runoooooob \u7b49\uff0c+ \u53f7\u4ee3\u8868\u524d\u9762\u7684\u5b57\u7b26 […]<\/p>\n","protected":false},"author":643,"featured_media":166021,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-166014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/166014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/643"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=166014"}],"version-history":[{"count":6,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/166014\/revisions"}],"predecessor-version":[{"id":166016,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/166014\/revisions\/166016"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/166021"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=166014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=166014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=166014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}