Test, validate and match regular expressions
Matches a forward slash at the start of a string (^/) or at the end of a string (/$). With the global flag enabled, it detects both leading and trailing slashes in a single pass, typically for removal. Commonly used to normalize URLs and file paths, e.g. stripping '/path/to/page/' down to 'path/to/page'. Ideal for route cleanup and input sanitization in web development.