There are several ways to regex a rfc3986 compatible URL
For string C, the regex will look like this:
"^(([^:/?#]+):)?(//([^/?#]*)|///)?([^?#]*)(\\?[^#]*)?(#.*)?"
enum {
URL = 0,
SCHEME_CLN = 1,
SCHEME = 2,
DSLASH_AUTH = 3,
AUTHORITY = 4,
PATH = 5,
QUERY = 6,
FRAGMENT = 7
};
If the listing indicates which capture indexes correspond to those parts of the URL.
source
share