Regex Tester
Test a regex on your own text with highlighting and capture groups, get the expression explained piece by piece in plain words, and catch patterns that hang the parser.
Good to know
Matches and groups
Pattern breakdown
Ready-made code
Matching runs on the JavaScript engine. Python, PHP and Go use almost the same syntax, with a few differences — for one, JavaScript has no x flag for comments inside the pattern.
A regular expression is hard to read even for its own author, and a month later it is harder still. Regex Tester breaks one into parts and labels each part in plain words: where the start of a line is, where a capturing group sits, and what the lookahead ahead of it checks.
Regular expressions have a trap that can take down production servers. A pattern like (a+)+b run against a string of thirty identical letters forces the engine to try an ever-growing number of ways to split the string: one second, then a minute, then an hour. This is called catastrophic backtracking, and one line typed into a search form has been known to lay a site down this way.
We look for such constructions in your expression beforehand and explain in words what exactly is dangerous about them. The expression itself runs in a separate thread with a time limit: if it hangs, we cut it off, and the page stays alive.
Cyrillic behaves differently than expected
The shorthand \w in JavaScript matches a Latin letter, a digit, or an underscore, so Cyrillic letters do not fall under it. Next to Cyrillic, the word boundary \b also acts strangely. We notice such combinations in your text and suggest what to replace them with: an explicit set [а-яёА-ЯЁ] or character properties in Unicode mode.
Groups, replacement, and ready-made code
Matches appear in a table with positions and capture groups, and named groups print by name. A replacement mode turns on separately, so you see what the text will become. The tested expression is assembled into ready-made code for JavaScript, Python, PHP, and Go: escaping differs between these languages, and moving a regex by hand is a common source of errors.
The result recalculates as you type
Every keystroke brings a fresh set of matches right away, so the table and the highlights track the text as you edit it, with nothing to run manually.
Rate this tool
Help us get better
Tell us what was missing.
Other tools
JSON Formatter
Format and repair JSON in the browser, flagging duplicate keys and long numbers
JWT Decoder
JWT parsing with fields explained and signature verification
CSV to JSON
A table to JSON with honest types and a reverse check
JSON to CSV
JSON to a table for Excel, with verification and formula protection
SQL Formatter
A readable query layout, verified against the source, with risky spots flagged
XML Formatter
Readable XML, errors explained with a hint, verified against the source
XML Validator
Markup, XSD schema, sitemap, YML and RSS rules, with the path to each error
String Escape / Unescape
Nine modes in both directions, catches double escaping