Test, validate and match regular expressions
Matches strings or lines ending with 'localhost', optionally preceded by a literal dot (e.g., '.localhost' or 'localhost'). With the 'i' flag matching is case-insensitive (LOCALHOST, Localhost), 'm' anchors $ to the end of each line, and 'g' finds all occurrences. Commonly used to detect localhost hostnames in URLs, logs, or network requests, such as preventing SSRF or filtering local traffic in tests.