10const static std::string pctEncoded =
"(?:%[0-9a-fA-F][0-9a-fA-F])";
11const static std::string schemeNameRegex =
"(?:[a-z][a-z0-9+.-]*)";
12const static std::string ipv6AddressSegmentRegex =
"[0-9a-fA-F:]+(?:%\\w+)?";
13const static std::string ipv6AddressRegex =
"(?:\\[" + ipv6AddressSegmentRegex +
"\\]|" + ipv6AddressSegmentRegex +
")";
14const static std::string unreservedRegex =
"(?:[a-zA-Z0-9-._~])";
15const static std::string subdelimsRegex =
"(?:[!$&'\"()*+,;=])";
16const static std::string hostnameRegex =
"(?:(?:" + unreservedRegex +
"|" + pctEncoded +
"|" + subdelimsRegex +
")*)";
17const static std::string hostRegex =
"(?:" + ipv6AddressRegex +
"|" + hostnameRegex +
")";
18const static std::string userRegex =
"(?:(?:" + unreservedRegex +
"|" + pctEncoded +
"|" + subdelimsRegex +
"|:)*)";
19const static std::string authorityRegex =
"(?:" + userRegex +
"@)?" + hostRegex +
"(?::[0-9]+)?";
20const static std::string pcharRegex =
"(?:" + unreservedRegex +
"|" + pctEncoded +
"|" + subdelimsRegex +
"|[:@])";
21const static std::string queryRegex =
"(?:" + pcharRegex +
"|[/? \"])*";
22const static std::string fragmentRegex =
"(?:" + pcharRegex +
"|[/? \"^])*";
23const static std::string segmentRegex =
"(?:" + pcharRegex +
"*)";
24const static std::string absPathRegex =
"(?:(?:/" + segmentRegex +
")*/?)";
25const static std::string pathRegex =
"(?:" + segmentRegex +
"(?:/" + segmentRegex +
")*/?)";
30const static std::string refRegexS =
"[a-zA-Z0-9@][a-zA-Z0-9_.\\/@+-]*";
31extern std::regex refRegex;
36const static std::string badGitRefRegexS =
"//|^[./]|/\\.|\\.\\.|[[:cntrl:][:space:]:?^~\[]|\\\\|\\*|\\.lock$|\\.lock/|@\\{|[/.]$|^@$|^$";
37extern std::regex badGitRefRegex;
40const static std::string revRegexS =
"[0-9a-fA-F]{40}";
41extern std::regex revRegex;
44const static std::string refAndOrRevRegex =
"(?:(" + revRegexS +
")|(?:(" + refRegexS +
")(?:/(" + revRegexS +
"))?))";