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

Runs entirely in your browser. Your input and files are not uploaded to any server. See the privacy policy for what is stored in your browser (favorites and history only). Privacy policy

Check it yourself: open your browser’s developer tools, select the Network tab and use the tool. Your file never appears in an upload request. Once this page is saved for offline use, you can also disconnect from the internet and keep working. Ads and anonymous visit statistics, when enabled, make their own requests, but they never receive your files or text.

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