Regex tester

Live test JavaScript regular expressions. Type a pattern, pick flags, paste a test string; matches are highlighted in the text, capture groups and positions are listed below. A replace string shows what String.replace() would produce. Runs entirely in your browser; no input is sent to a server.

/ / g


        
Replace preview

Quick reference
  • \d digit · \w word char · \s whitespace · . any one char
  • [abc] set · [^abc] not-in-set · [a-z] range
  • ^ start · $ end · \b word boundary
  • ? 0 or 1 · * 0 or more · + 1 or more · {n,m} between n and m
  • (abc) capture · (?:abc) non-capture · (?<name>abc) named capture
  • (?=abc) lookahead · (?!abc) negative lookahead