From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] slight glossing over 8) ? From: "Russ Cox" MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Tue, 12 Nov 2002 14:21:02 -0500 Topicbox-Message-UUID: 1bfbb992-eacb-11e9-9e20-41e7f4b1d025 if you _really_ want the right regexp, you should use the ones from webfs, due to jeff brown. /* RE character-class components -- these go in brackets */ #define PUNCT "\\-_.!~*'()" #define RES ";/?:@&=+$," #define ALNUM "a-zA-Z0-9" #define HEX "0-9a-fA-F" #define UNRES ALNUM PUNCT /* RE components; _N => has N parenthesized subexpressions when expanded */ #define ESCAPED_1 "(%[" HEX "][" HEX "])" #define URIC_2 "([" RES UNRES "]|" ESCAPED_1 ")" #define URICNOSLASH_2 "([" UNRES ";?:@&=+$,]|" ESCAPED_1 ")" #define USERINFO_2 "([" UNRES ";:&=+$,]|" ESCAPED_1 ")" #define PCHAR_2 "([" UNRES ":@&=+$,]|" ESCAPED_1 ")" #define PSEGCHAR_3 "([/;]|" PCHAR_2 ")" Retab retab[] = /* view in constant width Font */ { [REsplit] "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]+)?(\\?([^#]*))?(#(.*))?$", nil, 0, /* |-scheme-| |-auth.-| |path--| |query| |--|frag */ { 2, 4, 5, 7, 9}, [REscheme] "^[a-z][a-z0-9+-.]*$", nil, 0, { 0, }, [REunknowndata] "^" URICNOSLASH_2 URIC_2 "*$", nil, 0, { 0, }, [REauthority] "^(((" USERINFO_2 "*)@)?(((\\[[^\\]@]+\\])|([^:\\[@]+))(:([0-9]*))?)?)?$", nil, 0, /* |----user info-----| |--------host----------------| |-port-| */ { 2, 7, 12, }, [REhost] "^(([a-zA-Z0-9\\-.]+)|(\\[([a-fA-F0-9.:]+)\\]))$", nil, 0, /* |--regular host--| |-IPv6 literal-| */ { 2, 4, }, [REuserinfo] "^(([^:]*)(:([^:]*))?)$", nil, 0, /* |user-| |pass-| */ { 2, 4, }, [REabspath] "^/" PSEGCHAR_3 "*$", nil, 0, { 0, }, [REquery] "^" URIC_2 "*$", nil, 0, { 0, }, [REfragment] "^" URIC_2 "*$", nil, 0, { 0, }, [REhttppath] "^.*$", nil, 0, { 0, }, [REftppath] "^(.+)(;[tT][yY][pP][eE]=([aAiIdD]))?$", nil, 0, /*|--|-path |ftptype-| */ { 1, 3, }, [REfilepath] "^.*$", nil, 0, { 0, }, };