Build, test, and debug regular expressions
This regex matches either an empty string or a URL that begins with http:// or https://. It validates the domain by requiring one or more word/hyphen segments ending in a dot (subdomains), followed by a final segment for the TLD. It optionally allows path and query string characters including word chars, spaces, semicolons, commas, periods, slashes, ?, %, &, and =. Typically used in form validation where a URL field may be left blank but must be a valid absolute URL when filled in.