G
Guest
It is used to match a url:
Regex r = new Regex(@"^(?<proto>\w+)://[^/]+?(?<port>:\d+)?/",
RegexOptions.Compiled);
My question is , what does the pair of '?' mean? Since [^/]+ will match all
the tokens except the '/' token, which means it will also match the port, how
does this pair of '?' match the port?
Thanks in advance!
Regex r = new Regex(@"^(?<proto>\w+)://[^/]+?(?<port>:\d+)?/",
RegexOptions.Compiled);
My question is , what does the pair of '?' mean? Since [^/]+ will match all
the tokens except the '/' token, which means it will also match the port, how
does this pair of '?' match the port?
Thanks in advance!