About the Regex Tester
Tezmy's Regex Tester lets you build and check a regular expression while you type. Enter a pattern, switch on flags such as global, ignore case or multiline, and paste some test text: every match is highlighted in the text, counted, and listed in a table with its position and capture groups. Tick Replace to see the text after replacing matches, using $1, $2 or named groups. Start from common patterns such as email addresses, URLs, dates, UK postcodes and hex colours. You can also paste a literal like /\d+/g and the pattern and flags are split for you. The tester uses your browser's own JavaScript engine, and a pattern that runs away is stopped safely instead of freezing the page.
Updated September 2026
How to use the Regex Tester
- 1Type your regular expression in the pattern box, or pick a common pattern.
- 2Turn on the flags you need, such as g (all matches) or i (ignore case).
- 3Paste the text you want to search: matches are highlighted as you type.
- 4Check the groups table, and tick Replace to preview a replacement.
Regex cheat sheet
- \d digit, \w letter/digit/underscore, \s whitespace; capitals (\D, \W, \S) mean the opposite.
- . any character except a new line; [abc] one of a, b, c; [^abc] anything else.
- * zero or more, + one or more, ? optional, {2,5} between 2 and 5 times.
- ^ start and $ end of the text (or line with the m flag); \b a word boundary.
- (…) capture group, (?:…) group without capturing, a|b either a or b.
- (?=…) followed by, (?!…) not followed by, (?<=…) preceded by.
Tips for reliable patterns
- Be specific: [^"]* inside quotes is faster and safer than .*.
- Use \b around words so cat doesn't match inside concatenate.
- Test with tricky text as well as good examples: empty lines, extra spaces, other languages.
- Add the g flag when you want every match, and remember it for replace too.
- Keep complex patterns readable by building them step by step and testing each part.
Regex or a ready-made tool?
For many everyday text jobs there is a simpler tool: Remove Duplicate Lines, Remove Line Breaks, Sort Lines and the Case Converter handle common clean-ups without writing a pattern, and the Diff Checker compares two versions of a text.
Features
- Live highlighted matches
- Match count, positions and capture groups
- All JavaScript flags: g, i, m, s, u, y
- Replace preview with $1 and named groups
- Library of common patterns
- Paste /pattern/flags literals
- Runaway patterns are stopped safely
Frequently asked questions
Which regex flavour does this use?
JavaScript's, as built into your browser, so results match what String.match, replace and RegExp do in your code. Most everyday syntax is the same in Python, PHP, Java and .NET, but look-behind support, named group syntax and some classes differ slightly.
What do the flags mean?
g finds all matches instead of the first; i ignores upper and lower case; m makes ^ and $ match at the start and end of every line; s lets . match line breaks; u enables full Unicode and \p{…} classes; y (sticky) only matches exactly at the current position.
How do I use capture groups in the replacement?
Wrap parts of the pattern in parentheses, then use $1, $2 and so on in the replacement. For example, pattern (\w+)@(\w+) with replacement $2 at $1 turns name@site into site at name. Named groups (?<year>\d{4}) can be used as $<year>.
Why was my pattern stopped?
Some patterns, often with nested repeats like (a+)+ or (.*)*, can take an extremely long time on certain text. This is called catastrophic backtracking. The tester runs your pattern separately and stops it after a moment, so make the pattern more specific, for example by using [^,]+ instead of .*.
How do I match a special character like . or ?
Put a backslash before it: \. matches a full stop, \? a question mark, \( a bracket. Inside square brackets most characters don't need escaping, so [.?] matches either a full stop or a question mark.
Is my text uploaded?
No. Matching runs in your browser, so logs, customer data or code you test stay on your device.