Test, validate and match regular expressions
Matches an optional leading path (a string starting with /) followed by either a trailing slash at the end of a line or a slash immediately preceding a query string. Commonly used with replace() (e.g., '$1$3') to strip trailing slashes from URLs while preserving query parameters. The multiline flag enables processing multiple URLs or config lines (like nginx/htaccess redirects) in a single pass.