Given the URL (single line): http://test.example.com/dir/subdir/file.html
How can I extract the following parts using regular expressions:
None of the above worked for me. Here's what I ended up using:
/^(?:((?:https?|s?ftp):)\/\/)([^:\/\s]+)(?::(\d*))?(?:\/([^\s?#]+)?([?][^?#]*)?(#.*)?)?/