Set up a pattern and inspect matches
Enter a JavaScript regular expression in Pattern, add text to Input text, and read the selected values in Output text. The results table keeps the match, its line number, and a context snippet together.
How to extract text with a custom regex
- Enter a JavaScript pattern in
Pattern, between the displayed slash marks. - Paste text into
Input text, or chooseUploadfor a supported text file. - Turn on
i (case-insensitive),m (multiline), ors (dotall)when the pattern needs that behavior. - Choose
Full matchor a numbered group inExtractwhen the pattern contains parentheses. - Check
Output textand the results table, then useCopyorDownload.
What the regex options change
Type the expression itself in Pattern; the visible slash marks are already supplied. The script always adds the JavaScript global flag. i (case-insensitive) ignores letter case, m (multiline) changes line-anchor behavior, and s (dotall) lets a dot match newline characters.
Extract sets the value written to Output text. Full match keeps the complete match. Group 1, Group 2, and later options use the text captured by those parentheses. Unique only keeps the first occurrence of each selected value, so the count can change when you select another group.
Pattern: \b[A-Z]{2}-\d{4}\b
Input text: Order IDs: AB-1029, CD-2048, AB-1029.
Output text with Unique only: AB-1029
CD-2048
How input and results are handled
Upload accepts .txt, .csv, .json, and .log files. The output is separated by newlines. Each result row shows the selected value, its line number, and a context snippet made from nearby text.
An empty pattern or empty input gives 0 matches. An invalid JavaScript pattern clears the results and reports the regular-expression error below Pattern. A group that did not participate becomes an empty extracted value. Download saves the output as regex-matches.txt.
Where custom regex extraction comes up
Use a pattern such as \b[A-Z]{2}-\d{4}\b when a text block contains order IDs like AB-1029 and CD-2048. Turn on Unique only when repeated IDs should appear once in Output text.
For a CSV export, put the field inside a capture group and select that group in Extract. The table still shows the full match context, while the output contains the selected group. JavaScript regular expression syntax controls what the pattern can match.
Choose the right text extractor
Use Text Parsing & Data Extraction to compare extractors by task. Choose Extract Emails from Text for email matching with domain filtering, lowercase conversion, or duplicate removal.
Choose Extract Lines Containing a String when each result should be a whole line containing a word or regex pattern. Choose Extract Text Between Delimiters for content between quotes, brackets, parentheses, or custom start and end markers.
Frequently asked questions
What regex syntax does Custom Regex Extractor use?
Custom Regex Extractor uses JavaScript regular expression syntax. PCRE or Python syntax is not guaranteed to work, especially for advanced constructs.
How do I extract a capture group with regex?
Put parentheses around the part you need, then select its numbered group in Extract. The output uses that captured text instead of the full match.
Why does my custom regex show an error?
An invalid JavaScript pattern clears the matches and shows the regex engine's error below Pattern. Check for missing parentheses, brackets, or escapes.
How can I remove duplicate regex matches?
Enable Unique only to keep the first occurrence of each selected value. Turn it off when repeated matches belong in the output.