Regex Builder
Build a regular expression visually: add blocks such as digits, letters, text and groups, set how many times each repeats, and watch live matches. Exports to 8 languages.
Runs in your browser. Nothing you add is uploaded.
What the Regex Builder does
Regular expressions are powerful and famously hard to read. This builder lets you assemble one from plain-language blocks instead: the text “https://”, one or more digits, between two and four letters, one of cat, dog or bird, a group with a name. As you add blocks the expression, a plain-English reading of it and the highlighted matches in your test text all update live. Text is escaped for you, repeats are wrapped correctly, and the finished expression can be copied or exported as code for eight languages.
How to build a regular expression
- Start from one of the examples, such as email, date or phone number, or choose Clear all to begin with nothing.
- Use “Add a block” to add pieces in the order they should appear: text, digits, letters, a set of characters, options, a group, or an anchor such as the start of the text.
- For each block set how many times it should repeat: once, optional, one or more, exactly N, or between N and M.
- Paste text into “Try it” to see the matches highlighted. Turn the flags on or off: find all, ignore case, multiline.
- Copy the expression, pick a language to export it as code, or open it in the Regex Tester to go further.
The Regex Builder runs entirely in your browser — nothing you enter is uploaded, stored, or logged.
When to use it
Validating form input
Build a pattern for a postcode, a mobile number, a PAN or a username, and test it against good and bad examples before it goes into your code.
Extracting data from text
Pull dates, prices, IDs or hashtags out of logs, emails and documents with groups that capture just the part you want.
Learning regular expressions
See how each block becomes syntax, and read the English description of the result, to learn the notation by doing.
Good to know
- Anchors ^ and $ make a pattern match the whole text; leave them out to find matches inside longer text.
- “As few as possible” (lazy) repeats stop at the first possible place, which matters for things like quoted strings.
- Use a named group so your code can read results by name instead of by number.
- Look-arounds check the surroundings without including them in the match, which is useful for prices or numbers next to units.
- Test with both text that should match and text that should not.
Frequently asked questions
Do I need to know regular expressions to use it?
Why is my text escaped with backslashes?
Can I keep editing in the Regex Tester?
What regex flavour does it produce?
Can it read an existing regular expression back into blocks?
Is my test text kept?
Related tools
SQL Formatter
Format, beautify, and minify SQL queries for Postgres, MySQL, and SQLite.
JSON to YAML Converter
Convert bidirectional JSON to YAML and YAML to JSON with presets.
Chmod Permissions Calculator
Interactive 3x3 Linux permissions matrix, octal sync, and command generator.
Docker Run to Compose
Convert docker run CLI commands into docker-compose.yml files.