Regex tester
Try a regular expression, see exactly what it matches, and preview a replacement. Uses your browser’s JavaScript regex engine.
Free. No ads, no tracking, no sign-up. Your pattern and text stay in your browser.
Pattern and text
Write the pattern without enclosing slashes. For example, \d+ finds digits. An empty pattern matches an empty string.
Without g, find and replace only the first match. Sticky y starts at position 0 and cannot skip gaps. u and v are alternatives.
Up to 100,000 UTF-16 code units. No text is saved.
JavaScript is needed to test a pattern.
Highlights mark full matches. A vertical marker shows a zero-length match. Positions start at 0, count UTF-16 code units, and exclude the end position. The browser turns pasted Windows line endings (CR LF) into LF, so each line break counts as one unit and \r never matches.
Replacement preview
JavaScript replacement strings: $& whole match, $1 capture 1, $<name> named capture, $$ dollar, $` text before, $' text after. Type a real line break for a newline; \n stays literal. Empty replacement removes matches.
Test a pattern to preview its replacement.