Lazily matches one or more characters that are not a forward slash
2nd group: (?:\?.*)?$
Matches a query string (if any) starting with a question mark,
followed by zero or more characters until the end of string,
without creating a capturing group (the leading ?:)
When constructing the target filename from the given Source or Patch URL
(sub retrieve), do not include the query string (if present).
Example:
Regex explanation:
followed by zero or more characters until the end of string,
without creating a capturing group (the leading ?:)