Topic awaiting preservation: [reqex] In search of... (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: Berlin, Germany |
posted 03-31-2006 22:25
...a regular expression to validate a uri. |
Bipolar (III) Inmate From: Berlin, Germany |
posted 04-01-2006 10:50
The first part: code: [a-zA-Z][a-zA-Z0-9\+-\.]* # scheme :\/\/ ((([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\.)* # domainlabel [a-zA-Z][a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9] # toplabel \.?)| # additional period ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)) # IPv4 address (:[0-9]+)? # port
|
Bipolar (III) Inmate From: Berlin, Germany |
posted 04-01-2006 11:28
Ok, here is the full code: code: [a-zA-Z][a-zA-Z0-9\+-\.]* # scheme :\/\/ # ((([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\.)* # domainlabel [a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9] # toplabel \.?)| # additional period ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)) # IPv4 address (:[0-9]+)? # port / # ([a-zA-Z0-9-_\.!~*'\(\)] # unreserved |%[0-9a-fA-F]{2} # escaped |[:@&=\+\$;])* # (/([a-zA-Z0-9-_\.!~*'\(\)] # unreserved |%[0-9a-fA-F]{2} # escaped |[:@&=\+\$;])*)* # (\? # query: ([;\/\?:@&=\+\$,] # reserved |[a-zA-Z0-9-_\.!~*'\(\)] # unreserved |%[0-9a-fA-F]{2})*)* # escaped
|
Bipolar (III) Inmate From: Berlin, Germany |
posted 04-01-2006 12:59
Fixed some bugs, cleaned and added userinfo: code: [a-zA-Z][a-zA-Z\d\+\-\.]*:\/\/ # scheme + :// (([\w\-\.!~'\*\(\);:&=\+\$,]|%[\da-fA-F]{2})+@)?# userinfo ((([a-zA-Z\d][a-zA-Z\d\-]*[a-zA-Z\d]\.)* # domainlabel [a-zA-Z][a-zA-Z\d\-]*[a-zA-Z\d]\.?) # toplabel |([\d]+\.[\d]+\.[\d]+\.[\d]+)) # IPv4 address (:[\d]+)? # port / # path: ([\w\-\.!~\*'\(\):@&=\+\$;] # unreserved |%[\da-fA-F]{2})* # escaped (/([\w\-\.!~\*'\(\):@&=\+\$;] # unreserved |%[\da-fA-F]{2})*)* # escaped (\? # query: ([;\/\?:@&=\+\$,] # reserved |[\w\-\.!~\*'\(\)] # unreserved |%[\da-fA-F]{2})*)* # escaped
|
Maniac (V) Inmate From: Sthlm, Sweden |
posted 04-01-2006 22:54
Someone once said: "Hey, I can solve this problem with regular expressions!" This man now has two problems... |