Guide

Pattern finder

Generate regex from examples

Source text

8 lines

Examples

Regex candidates

Test
^(?<timestamp>\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)\s+(?:TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\s+user_id=(?<user_id>[+-]?(?:\d+\.\d+|\d+|\.\d+))\s+path=(?<path>/\S*)\s+status=(?<status>[+-]?(?:\d+\.\d+|\d+|\.\d+))\s+latency_ms=(?<latency_ms>[+-]?(?:\d+\.\d+|\d+|\.\d+))$
1/1 positives0/0 negatives5 capturesflags: none
Test
^(?<timestamp>\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)\s+(?:TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\s+[A-Za-z_][A-Za-z0-9_-]*=(?<user_id>[+-]?(?:\d+\.\d+|\d+|\.\d+))\s+[A-Za-z_][A-Za-z0-9_-]*=(?<path>/\S*)\s+[A-Za-z_][A-Za-z0-9_-]*=(?<status>[+-]?(?:\d+\.\d+|\d+|\.\d+))\s+[A-Za-z_][A-Za-z0-9_-]*=(?<latency_ms>[+-]?(?:\d+\.\d+|\d+|\.\d+))$
1/1 positives0/0 negatives5 capturesflags: none
Test
(?<timestamp>\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)\s+(?:TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\s+user_id=(?<user_id>[+-]?(?:\d+\.\d+|\d+|\.\d+))\s+path=(?<path>/\S*)\s+status=(?<status>[+-]?(?:\d+\.\d+|\d+|\.\d+))\s+latency_ms=(?<latency_ms>[+-]?(?:\d+\.\d+|\d+|\.\d+))
1/1 positives0/0 negatives5 capturesflags: none
Test
^2026-06-13 09:13:02\s+ERROR\s+user_id=[+-]?\d+\s+path=/api/orders\s+status=[+-]?\d+\s+latency_ms=[+-]?\d+$
1/1 positives0/0 negatives0 capturesflags: none

Matches

0 found
Generate a regex and scan the source.

Detected tokens

timestamp 2026-06-13 09:13:02space word ERRORspace word user_idsymbol =number 9281space word pathsymbol =path /api/ordersspace word statussymbol =number 500space word latency_mssymbol =number 338

Guide: Regex Generator & Pattern Finder

Back to tool

What is this tool?

A regex generator from text helps you turn example log lines, IDs, URLs, CSV-like rows, or plain text snippets into regular expression candidates. Paste a large file, add one or more strings that should match, and Spoold suggests patterns that you can test against the source without uploading data.

This is different from a regex tester. The Regex Tester is best when you already have a pattern. The Regex Generator & Pattern Finder starts from examples, detects token shapes, creates candidate regexes, and scans the text for matching lines.

Workflow

  1. Paste or upload a text file, log file, CSV export, or raw text sample.
  2. Add one or more positive examples that must match.
  3. Add optional negative examples that must not match.
  4. Generate regex candidates and compare loose, balanced, strict, and extractor patterns.
  5. Scan the source text, review matching lines, and copy or open the regex in the Regex Tester.

Log regex generator

Log lines often combine stable labels with variable values. The generator recognizes common tokens such as timestamp, date, time, ip, uuid, email, url, path, number, and quoted strings.

Input shapeGenerated idea
2026-06-13 09:13:02Timestamp capture with date and time shape.
user_id=9281Literal key plus a named numeric capture.
path=/api/ordersLiteral key plus a path capture.
request_id=uuidUUID shape with a named group when the key is visible.

Positive and negative examples

One example can only produce a guess. Add multiple must-match examples when possible, then add a few must-not-match lines to make the pattern less broad. The confidence score rewards candidates that match positives and avoid negatives.

Generated regex types

  • Balanced keeps stable text literal and captures variable values such as IDs, dates, paths, and statuses.
  • Loose generalizes more text to find similar lines in noisy logs or inconsistent exports.
  • Strict stays closest to the sample while still allowing flexible whitespace and numeric values.
  • Extractor removes line anchors so the pattern can find a matching substring inside longer lines.

Large file scanning

Scanning is manual and chunked. The tool processes lines in batches, updates progress, and previews the first set of matches instead of continuously rerunning on every keystroke. That keeps log regex generation usable for large pasted files and uploaded text files.

Limits

  • Regex generation is inference, not proof. Always test the candidate on real positives and negatives.
  • JavaScript regular expressions are used, so PCRE-only features may not work.
  • Highly irregular text may need manual edits in the Regex Tester after generation.
  • For structured JSON, XML, or CSV data, a parser is usually safer than regex extraction.

FAQ

Can this generate regex from one example?

Yes, but one example is only a starting point. Add more positive and negative examples to make the pattern more reliable.

Does this upload my log file?

No. The generation and scanning run in your browser.

Can I edit the generated regex?

Yes. Copy it or open it in the Regex Tester to refine flags, groups, anchors, and replacements.

What regex flavor does it generate?

JavaScript / ECMAScript regular expressions, including named capture groups when supported by the browser.

Similar tools

Already have a pattern? Open the Regex Tester to debug matches, flags, capture groups, and replacements.