A ready-to-test pattern for matching URLs in a block of text.
This tool runs a JavaScript regular expression against a block of text and lists every match with its position, so you can check a pattern is doing what you expect before dropping it into code.
Enter a pattern and optional flags (g for global — required to see every match rather than just the first — i for case-insensitive, m for multiline). The tool re-evaluates on every keystroke, so you can adjust the pattern and immediately see how the match list changes.
If your pattern includes capture groups, each match also shows the captured sub-values, which is useful when you are extracting a piece of a larger string rather than matching the whole thing.
Worked example: the pattern #\w+ with the g flag against "Loving this #sunset walk today. #nature #photography #goldenhour" finds all four hashtags — # matches the literal character, and \w+ greedily matches one or more letters, digits, or underscores immediately following it. For capture groups: \((\d{3})\) against "Call (555) 123-4567" matches the full "(555)" but also captures just "555" separately — the parentheses in the pattern mark what to capture, while the escaped \( and \) match the literal parenthesis characters in the text, which is the detail that trips people up first, since parentheses mean two different things in the same pattern depending on whether they're escaped.
Add the g (global) flag. Without it, JavaScript regex only returns the first match.
JavaScript’s native RegExp engine (ECMAScript regex), which differs slightly from PCRE or Python’s re module in some edge cases like lookbehind support in older environments.
Add the m flag to make ^ and $ match the start/end of each line rather than the whole string.