PERMARKET
Tools › Developer › Regex Builder
RE

Regex Builder

Assemble a regular expression piece by piece and test it against your own text.

Stack tokens to build a pattern

Your pattern appears here…
Ad · Large Rectangle (336×280)

How to use Regex Builder

Regex Builder lets you assemble a regular expression one token at a time instead of typing it from memory, then test it against your own text to confirm the matches before you ship it.

  1. Open Regex Builder on toolpermarket — the form is ready, so type your numbers and read the result.

  2. In the Tokens field, click Add token and pick a type for each piece of the pattern — a literal, a character class, a group or a quantifier. tokens are read top to bottom, so order them the way the text should match.

  3. In the Flags field, add flags such as g for global or i for case-insensitive in the Flags box. use g when you want every match, not only the first.

  4. In the Test string field, paste the text you want to match against, then press Build & test. try a few real examples, not just one, to catch edge cases.

  5. Press Build & test to compute the result. The output appears immediately below the form. Edit a value and press the button once more to see the updated answer.

  6. Read the result and use it as needed. If the number looks off, re-check your inputs and run it again — the math is deterministic, so the same entries always return the same answer.

Worked example. Add a Digit token, then a Literal "." token, then another Digit token, and test against "Release v2.3" to match the version number 2.3.

Tips for accurate results.

  • Start with a Literal token for the fixed part of the text, then add character classes only where the value varies.

  • Use a Group token when you need to capture part of the match — the first capture group is shown after you test.

  • Turn on the i flag if the source text mixes upper and lower case and you do not want to list both.

When to use Regex Builder. Pulling order numbers, phone numbers or dates out of a block of pasted text. Checking a pattern before pasting it into a validator, a log filter or a find-and-replace. Teaching someone what each part of a regular expression does by building it piece by piece.

When you actually reach for this

  • You need a pattern but keep guessing at quantifiers, groups and escapes.
  • You want to confirm a pattern actually matches your real text before shipping it.

Where this tool stops being accurate

  • It builds from the tokens you stack, so it cannot infer intent from a plain description.
  • Literals are escaped for you, but a malformed custom class still produces an invalid regex.
  • Matching runs in your browser against the test string you paste; nothing is sent anywhere.

Frequently asked questions

Does Regex Builder send my text to a server?

No. The pattern is built and tested entirely in your browser. The text you paste never leaves your device, so it is safe for sample data, logs or anything sensitive.

What is the difference between a literal and a character class?

A literal matches exactly the characters you type, while a character class such as Digit or Word matches a whole category — any digit, any word character, and so on. Use literals for fixed text and classes for parts that vary.

Why do I get "no matches"?

Most often the order of tokens does not match the text, or a quantifier is missing. Build the pattern slowly, test after each token, and confirm the test string actually contains the shape you expect.

What does the g flag do?

The g (global) flag finds every occurrence in the test string instead of stopping at the first. Without it you only see the first match highlighted.

Can I capture part of the match?

Yes. Add a Group token around the portion you want, and after testing the first match the capture group is shown so you can copy just that piece.

Is the generated pattern a standard regex?

It is a JavaScript regular expression, which covers the common syntax most validators and editors also understand. Very engine-specific features may behave differently elsewhere.