How regex extraction works here
The tool calls String.prototype.match(new RegExp(pattern, flags)) with the Pattern and Flags from the settings panel, then joins the matches with your chosen Separator. Anything that is valid JavaScript regex syntax is accepted: character classes, anchors, lookaheads, lookbehinds, named groups, Unicode escapes. The g flag is on for every preset because the tool needs all matches, not just the first.
Capture groups are not extracted on their own. match with the g flag returns the full match strings, not the groups. If you want a specific group, wrap the rest of the pattern in (?:...) non-capturing groups and put the part you want last. To rewrite matches into a different shape entirely, use regex replace, which respects $1, $2 and named back-references.
When the pattern is empty the tool prints a hint instead of running. When the pattern is invalid the tool catches the SyntaxError and shows the message, so you can fix the pattern without losing your input. Use this tool whenever the dedicated extract pages (emails, URLs, phones) are too narrow or too loose for your data.
How to use extract regex matches
- 1Paste your text into the input panel.
- 2Open the settings panel and type a regex into Pattern (for example
\b\w+\bfor words). - 3Set Flags to
g,gi(case-insensitive) orgm(multiline anchors). - 4Set Separator to
Newline,Space,CommaorTabdepending on how you want the matches joined. - 5Click Copy or Download on the output panel when the result looks right.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run a saved workflow Plus |
What this tool actually does
Pattern uses native JavaScript regex
Anything RegExp in your browser supports works here: character classes [a-z], anchors ^ $ \b, quantifiers, alternation, lookaheads (?=...), lookbehinds (?<=...), named groups (?<name>...), Unicode escapes \p{...} (with the u flag, which the tool accepts inside the pattern).
Flags dropdown: g, gi, gm
g matches all occurrences (always on). gi adds case-insensitive matching. gm makes ^ and $ match at line breaks instead of just the start and end of the input. To combine flags (e.g. gim), put the extras inside an inline modifier at the start of the pattern: (?i) or (?m) in browsers that support inline flags.
Separator dropdown: newline, space, comma, tab
The matches are joined with the chosen string. Newline gives one match per line (best for piping into other tools). Comma adds ", " between matches. Tab gives a TSV-friendly single line.
Empty or invalid pattern is handled
If the Pattern field is blank, the output reads [enter a pattern in the Settings panel]. If the pattern fails to compile, the output shows [invalid regex] followed by the browser's error message, so you can adjust the pattern without losing your input.
Capture groups are not extracted separately
With the g flag, JavaScript's match returns full match strings only. Capture groups are ignored. To pull just one group out, wrap the rest in (?:...) and put your wanted text outside the non-capturing groups. To rewrite matches, switch to regex replace.
Worked example
Pattern #\d+, flags g, separator newline. Change the pattern to v\d+\.\d+\.\d+ and you get v2.0.1 and v2.1.0 instead.
Order #4821 ships Apr 12. Order #4822 ships Apr 13. Contact [email protected] or [email protected]. Versions v2.0.1 and v2.1.0.
#4821 #4822
Settings reference
| Setting | Effect on output |
|---|---|
| Pattern | Any JavaScript regex. Empty pattern prints a hint; invalid pattern prints the browser's error. |
| Flags = g | Global. Returns every match in source order. |
| Flags = gi | Global plus case-insensitive. HELLO and hello both match hello. |
| Flags = gm | Global plus multiline. ^ and $ match line starts and ends, not just the input boundaries. |
| Separator = Newline | One match per line. Best for piping into other tools. |
| Separator = Space | Matches joined by single spaces. |
| Separator = Comma | Matches joined by , for CSV-style output. |
| Separator = Tab | Matches joined by tabs. Drop straight into a TSV column. |
FAQ
How do I extract just one capture group?
match with the g flag returns full match strings, not groups. Two workarounds: wrap the parts you do not want in non-capturing groups (?:...) and use lookarounds (?<=prefix)wanted(?=suffix) to anchor the match without including the prefix or suffix; or switch to regex replace, which supports $1, $2 and named back-references in the replacement.Why is my ^ only matching at the start of the input?
gm. With g alone, ^ and $ match the start and end of the whole input. With gm, they match the start and end of each line.Can I use Unicode property escapes like \p{L}?
\p{L}+ with flags gu matches runs of any Unicode letter. To get the u flag in the dropdown, put it inline at the start of the pattern: (?u)\p{L}+ in browsers that support inline flags, or rely on the g flag and let the engine treat the pattern as Unicode-aware where possible.What happens if my pattern has a syntax error?
[invalid regex] followed by the browser's parse error. Your input is not modified, so you can fix the pattern and try again. Common gotchas: unescaped slashes inside character classes, mismatched parentheses, and invalid back-references.