Regex Tester

Write a pattern, paste sample text and see every match highlighted with its groups. Try a replacement string before using it in code. Uses the same regex engine as your browser’s JavaScript.

Matches highlighted

Runs entirely in your browser. Your input and files are not uploaded to any server.

How to use

  1. Enter a pattern without slashes, and choose flags.
  2. Paste the test text. Matches are highlighted as you type.
  3. Inspect the match table for positions and capture groups.
  4. Optionally enter a replacement (use $1, $<name>) to preview the result.

Examples

Email-like strings

Pattern [\w.+-]+@[\w-]+\.[\w.]+ with flag g.

Dates

(?<y>\d{4})-(?<m>\d{2})-(?<d>\d{2}) and replacement $<d>/$<m>/$<y>.

Privacy

Your files and text stay in your browser while you use this tool, and ads or anonymous visit statistics do not receive them. Only your favorites and recent tools are saved on your device. Privacy policy

Want proof? Check it with your browser’s Network tab: How to check that a tool does not upload your files

Frequently asked questions

Which regex flavour is this?

ECMAScript (JavaScript) as implemented by your browser. PCRE, Python and .NET have differences, such as possessive quantifiers and some lookbehind rules.

Can a bad pattern freeze the page?

Patterns with catastrophic backtracking can be slow. The tool limits the number of matches shown and the text length; if a pattern is very slow, simplify nested quantifiers like (a+)+.

Text CleanerClean messy text: remove extra spaces, line breaks, HTML tags, emoji, Arabic diacritics, invisible characters and smart quotes in one pass.
Diff CheckerCompare two files or code snippets line by line with added and removed lines highlighted.
SVG Preview & OptimizerPreview SVG files safely and shrink them by removing comments, editor metadata and whitespace, with optional number rounding.
Color Picker & ConverterPick a colour, convert between HEX, RGB and HSL, sample colours from an image or your screen, and check contrast against white and black text.
Search tools