Skip to content

Regex Tester

Test regular expressions and see all matches and groups.

Loading…

About Regex Tester

A pattern that works on three lines of sample text can fall over on real data. Enter the pattern without slashes, set the flags and paste a test string: matches are highlighted in a preview and listed one by one with their capture groups, named groups included. The page uses your browser's own JavaScript RegExp, so it behaves like regular expressions in code running in that browser. A pattern that backtracks for too long is stopped after 1.5 seconds instead of freezing the tab.

Features

  • Runs your browser's own JavaScript regular expression engine
  • Accepts the flags d, g, i, m, s, u, v and y
  • Highlights matches inside the test string
  • Lists each match with its capture groups, shown by name when the pattern names them
  • Stops runaway patterns after 1.5 seconds in a background worker
  • Shows empty matches together with their position

Limitations

  • The test string can be up to 50,000 characters, and both the list and the highlighting stop after 500 matches.
  • Only JavaScript syntax is accepted, so patterns written for PCRE, Python or .NET may need changes, and newer features such as the v flag depend on your browser.
  • The tester reports matches only: there is no replace mode and no explanation of what the pattern does.

How it works

  1. Type the pattern into the Pattern field, leaving off the slashes at either end.
  2. Adjust the Flags field. It starts as i, and each flag can be used once.
  3. Paste the text to search into the Test string box.
  4. Read the match count, the highlighted preview and the numbered match list, which shows capture groups and named groups.
  5. Keep editing and the results refresh, or select Reset to clear everything and put the flags back to i.

Example input

\b\w+@\w+\.\w+\b

Frequently asked questions