# Regex tester

Test JavaScript regular expressions with live highlighting, capture groups and a plain-language explanation.

https://codeknife.dev/en/regex-tester/

## What it does

Test a regular expression against your text and see every match highlighted, with its capture groups listed. The pattern runs in a separate worker with a time limit, so a pattern that backtracks badly cannot freeze the page. Nothing you type leaves your browser.

## How to use it

1. Type your pattern, without the surrounding slashes.
2. Choose the flags: `g` (all matches), `i` (ignore case), `m` (multiline), `s` (dot matches newlines), `u` (Unicode) and `y` (sticky).
3. Paste the text to search. Matches are highlighted as you type, and groups appear in the list.
4. Select a match to see its position and each group's value.
5. Open the Quick reference tab beside the explanation to look up a token and insert it at the caret.

## Examples

Find the words in a sentence with `\b\w+\b`:

```
Hello, world!  →  Hello, world
```

Capture a date with named groups using `(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})`:

```
2026-10-09  →  year 2026, month 10, day 09
```

## Good to know

- JavaScript, PCRE2, Rust and Go run on their own engine; the last three are WebAssembly modules loaded when you pick them.
- Python, Java, .NET, POSIX ERE and POSIX BRE are emulated: the pattern is checked for syntax the flavor lacks, rewritten and run on PCRE2. Rare edge cases can differ from the real thing, and POSIX alternation picks the longest match where the emulation picks the first alternative that matches.
- Lookbehind (`(?<=…)`) and named groups work in modern browsers.
- If a pattern times out, simplify nested quantifiers such as `(a+)+`.

## What is a regular expression?

A regular expression (regex) is a compact pattern for finding text: it describes what to look for rather than the exact words. Developers use them to search, validate and extract data. This tester runs JavaScript, PCRE2, Rust and Go patterns on their own engines, and emulates Python, Java, .NET and POSIX on PCRE2, so check the flavor before you copy a pattern elsewhere.

## Frequently asked questions

### What do the flags do?

g finds every match instead of the first, i ignores upper and lower case, m makes ^ and $ match at every line, s lets the dot match line breaks, and u turns on full Unicode support.

### Why does my pattern stop with a timeout?

Some patterns can take exponentially long on certain text (catastrophic backtracking). The tester stops them after two seconds so your page never freezes.

### Is my text sent anywhere?

No. The pattern and text are processed in your browser and nothing is uploaded.