Regex Tester

Test a JavaScript regular expression against your text and list every match, index and capturing group.

The pattern only, without slashes. For example: \d+

Any of d, g, i, m, s, u, v and y, each once. Without g only the first match is found.

Tested in your browser. Nothing is sent to Numerila.

How it works

The test runs in your browser using its JavaScript regular expression engine, the same one that runs on web pages. This is not PCRE, Python, Java, .NET or RE2, and their syntax and behaviour differ in places, so check a pattern in the language you will really use.

With the g flag every match is listed, and without it only the first. A match with no characters, such as one from a*, is listed at its position and the search always moves on, so it cannot loop forever. Indexes count UTF-16 code units, as JavaScript does, so an emoji takes up two positions. Line breaks and tabs in a match are shown as \n and \t in the list.

The pattern can be up to 1,000 characters, the text up to 100,000, and at most 1,000 matches are shown. A pattern that backtracks heavily can make your browser tab slow or unresponsive. This tool cannot prevent that, so close the tab if it happens.

What this result means

The result lists each match with its position and groups, using the JavaScript regular expression engine of your browser.

Examples

  • The pattern \d+ with the g flag on "a1 b22": Two matches: "1" at index 1 and "22" at index 4

Assumptions and limitations

  • Only JavaScript regular expressions are tested. Patterns for other languages can behave differently.

Analytics only runs if you choose to allow it below. Advertising and affiliate tracking are not currently used on Numerila. This panel exists so your preference is on record for if that ever changes.