All Over Tools logo
Tool Combiner
Analyze Tools Clean Tools Compare Tools Convert Tools Data Validation Extract Tools Format Tools Generate Tools Organize Tools Transform Tools
Audio Tools Font Tools Image Tools Subtitle Tools Video Tools
Archive Tools Document Tools Ebook Tools File Management Tools PDF Tools Presentation Tools
Config Tools Database Tools Dataset Tools JSON Tools Parser Tools Spreadsheet Tools XML Tools
Business Calculators Construction Calculators Date And Time Calculators Education Calculators Financial Calculators Food Calculators Health Calculators Math Calculators Science Calculators Sports Calculators Statistics Calculators
Blog About Us Contact Us

Custom Regex Extractor

Write a JavaScript regular expression and pull out matching text from your input, with capture groups, flags, line numbers, and surrounding context.

Flags

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

  1. Enter a JavaScript pattern in Pattern, between the displayed slash marks.
  2. Paste text into Input text, or choose Upload for a supported text file.
  3. Turn on i (case-insensitive), m (multiline), or s (dotall) when the pattern needs that behavior.
  4. Choose Full match or a numbered group in Extract when the pattern contains parentheses.
  5. Check Output text and the results table, then use Copy or Download.

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.

Related Tools

45 views