Expression |
(?<url>
(?<protocol>
http(s?)
|
ftp
)\:\/\/
(?<host>
(?<hostname>
(
(?<subdomain>
([a-z]\w*\.)*[a-z]\w*
)\.
)?
(
(?<ip>
(\d{1,3}\.){3}\d{1,3}
)
|
(
(?<org>
[a-z]\w*
)\.
(?<domain>
[a-z]{2,3}
)
)
)
)?
(\:
(?<port>
\d+
)
)?
)
(?<path>
(?<directory>
(\/.*)*\/
)?
(?<file>
[a-z]\w*\.\w+
)?
)?
(\#
(?<hash>
[^?\n\r]+
)
)?
(\?
(?<search>
(\&?[^\=\n\r]+\=[^\&\n\r]*)+
)
)?
) |
Description |
Thanks to Ariel Merrell, as well as the folks who developed the javascript location object for some of the inspiration for this.
This was intended primarily to help break down the parts of a URL for easier processing, and not as a validator. Please make sure the following options are met
- .Net RE
- Case Insensitive
- Ignore pattern whitespace
- Explicit Capture.
|