All tools · Utilities

Regex Tester

Test a regular expression against text and see matches.

Free to use, no sign-up required. Regex Tester is one of 198 tools built into Xenition, alongside a chat that can use them for you.

Tests a regular expression against sample text and lists every match, for building or debugging a pattern before using it in code.

How to use Regex Tester

  1. Type the Pattern without surrounding slashes, for example \d+.
  2. Pick the Flags: g, gi, gm, gim, gs or giu.
  3. Paste the Test string.
  4. Read the match count and each match, or the error message if the pattern is invalid.

How it works

The pattern runs on your browser’s JavaScript regular expression engine, so its syntax is JavaScript’s, including lookbehind and named groups in current browsers. The g flag is always on, so every match is listed; i ignores case, m makes ^ and $ match at line breaks, s lets . match newlines and u enables Unicode mode. Only whole matches are shown, not capture groups, and up to 60 are displayed.

Example

The pattern \d{3}-\d{4} on “Call 555-0142 or 555-0199 today” gives 2 matches: 555-0142 and 555-0199. The pattern cat with gi on “Cat cat CAT” gives 3 matches; with g alone it gives 1.

Questions about Regex Tester

Why does my pattern show empty matches?

Patterns that can match nothing, such as \d*, also match the empty gap between characters. Use + instead of * when at least one character is required.

Will a pattern that works here work in Python or PHP?

Basic syntax is shared, but details differ between engines, such as named group syntax and lookbehind rules. Test in the target language before relying on advanced features.

Use it from chat

You do not have to open Regex Tester to use it. Ask Xenition in plain language and it runs the right tool, then carries the answer into whatever you are working on — a document, a spreadsheet, a deck.

Related tools