Regex Builder
- ClassLazy
Fragment
\d+
- Pick a ready-made pattern — email, URL, IPv4, UUID — or start from a single block.
- Each block becomes a piece of the expression, in the order it appears in the list. Use the arrows to reorder.
- Set the repetition per block: once, optional, zero or more, one or more, or an exact count.
- Paste sample text in the bottom panel to watch the matches while you build.
- When the pattern is ready, use the shortcut to open it in the tester and work on the capture groups.
- Ready — a complete, already tested pattern such as email or UUID. A starting point.
- Class — the engine shortcuts: digit, word character, whitespace and their negations.
- Set — the characters you type become a bracketed class. Negating flips the choice.
- Literal — text matched exactly. Metacharacters are escaped for you.
- Group — alternation between words, capturing or not. A named group keeps long patterns readable.
- Anchor — start, end and word boundary. They take no repetition because they consume no character.
- Raw — a hand-written regex fragment, unescaped. This is how a pattern coming from the tester gets in.
A quantifier applies only to what sits immediately before it. Applying "one or more" to the text abc would produce abc+, which repeats the c alone.
To avoid that, the builder wraps the fragment in a non-capturing group whenever it is not atomic: (?:abc)+. Classes, shortcuts such as \d and already closed groups need no wrapper and are left alone.
The lazy option appends ? to the quantifier. Instead of matching as much as possible and backtracking, the engine matches as little as possible — the difference between .* and .*? when capturing content between tags.
Blocks are read in sequence, so lookahead, lookbehind and backreferences remain the job of the raw block.
Ready-made patterns match shape, not validity: the CPF preset accepts 000.000.000-00 because a check-digit test does not fit in a regular expression.
The generated expression targets the JavaScript engine. Before moving it to PCRE, Python or Go, check lookbehind and Unicode classes, which differ between implementations.
A quantifier nested over an alternation group is where catastrophic backtracking starts. If the sample text stalls, simplify before shipping the pattern.
Frequently asked questions
Not in the literal block or in group alternatives — escaping happens while the pattern is assembled. In the raw block you do: it enters the expression exactly as typed.
The pattern and the flags travel with it and arrive already filled in. On the way back, the whole expression enters as a raw block, because an arbitrary regex cannot be split into blocks without risking a change in meaning.
Anchors match a position, not a character. Repeating ^ or \b changes nothing about what the expression finds and only makes the pattern harder to read.
A capturing group keeps the matched text for later use and shows up in the tester group list. A non-capturing group only groups so a quantifier or alternation can apply — it is faster and keeps the result clean.