How to extract matches with a custom pattern
Enter a JavaScript regular-expression pattern and the text to search. The tool finds all matches automatically and shows the selected values in the read-only output box. Results update when you change the pattern, input text, flags, Extract: selection, or Unique only.
Controls and matching options
Enter the pattern between the displayed slash marks; do not add another pair of surrounding slash delimiters. The interface starts with i (case-insensitive) and Unique only enabled. The other flags start disabled.
- i (case-insensitive) ignores letter case while matching.
- m (multiline) enables multiline regular-expression behavior.
- s (dotall) lets the dot match newline characters.
- Extract: choose Full match or a numbered Group N when the pattern has capture groups.
- Unique only removes repeated selected values. Matching is always global; there is no separate global-flag control.
Use the tool step by step
- Enter a JavaScript regular-expression pattern in the pattern field.
- Enable i (case-insensitive), m (multiline), or s (dotall) if the pattern needs those options.
- Paste text into the input area, or use Upload or Drop file to load a file.
- Under Extract:, select Full match or a numbered capture group.
- Review the updated output and result table. Use Copy or Download when you need the extracted values elsewhere.
Upload text and handle files
Upload opens a file picker filtered to .txt, .csv, .json, and .log. The page reads the selected file as text and places it in the input area. Dropped files are also read as text; the page-specific drop handler does not visibly type-check the dropped file before reading it.
Understand results, deduplication, and export
The read-only output box lists extracted values separated by newlines, and the footer shows the result count. The table can show the selected value under Match, its Line number, and a short Context snippet around the match.
With Unique only enabled, duplicates are removed using the selected extracted value. Therefore, switching from Full match to Group N can change which rows count as duplicates. Turn it off when repeated values should remain in the output.
Copy copies the output text. Download saves the newline-separated values as the plain-text file regex-matches.txt.
Troubleshooting and limitations
- An empty pattern or empty input produces
0 matches. - An invalid JavaScript pattern clears the results and shows the regular-expression engine error below the pattern field.
- If a selected capture group did not participate in a match, its extracted value is empty.
- The matching workflow uses JavaScript
RegExpbehavior. PCRE or Python syntax is not guaranteed to work, especially for advanced constructs. - The tool runs the pattern as written; it does not perform semantic validation for a particular data type. No local input-size limit is documented.
Matching is performed locally in the browser by this page's script. That describes the matching workflow only and is not a universal privacy or security guarantee for the whole website.
Frequently Asked Questions (FAQs)
What regex flavor does this tool use?
Standard JavaScript regular expression syntax, since matching runs directly in your browser. PCRE or Python syntax is not guaranteed to work, especially for advanced constructs.
Can I extract a specific capture group instead of the whole match?
Yes. If your pattern includes parentheses to define capture groups, the Extract: control lets you choose whether to extract the full match or a specific numbered group.
What happens if my pattern is invalid?
The tool shows the JavaScript regex engine's error message right under the pattern field, so you can fix typos or unbalanced parentheses immediately.
Why is this separate from the preset entity extractors?
Preset extractors (emails, phone numbers, addresses, etc.) hardcode patterns tuned for a specific entity type. This tool instead hands full control of the pattern to you, which suits developer workflows, log parsing, and one-off extraction tasks that don't match a preset.