Test, validate and match regular expressions
This regex matches a URL or file path and captures the file extension from it. It skips query strings (starting with `?`) and hash fragments (starting with `#`), making it ideal for extracting file extensions from web URLs like `document.pdf?version=2` or `image.jpg#section`.