Regex Tester

Test regular expressions with live match highlighting and capture groups for extraction and validation rules.

Free

Pattern

Flags
/(\w+)/g

Test String

Matches

What is Regex Tester tool?

Regex Tester lets you try a JavaScript regular expression against sample text and inspect highlighted matches, match positions, and capture groups. It is useful while developing a parser, extracting a field from a log, or checking a validation rule before adding it to code. Matching runs locally in the browser; the test text is not uploaded by this operation.

Enter the pattern, not a literal wrapper

Type the pattern body without surrounding slash delimiters. Choose supported flags separately: global searches for multiple matches, ignore-case changes case matching, multiline changes line anchors, and dot-all lets a dot match line breaks. The engine is JavaScript RegExp, not PCRE, Python, or a database-specific regex dialect. A pattern accepted here may need changes in another runtime.

Start with a reproducible match

Pattern body:

id=([0-9]+)

Test text:

id=42 id=7

With global enabled, the result contains two full matches, id=42 and id=7, and the corresponding capture-group values 42 and 7. Without global, only the first match is reported. Parentheses define the captured portion; matching text does not by itself replace or rewrite the input.

Test failures as well as successes

Try empty fields, extra separators, line breaks, and nearly matching strings. Anchors matter when validating a whole value: finding one matching substring is different from accepting the entire input. A broad email-like pattern is not proof of deliverability, ownership, or security. For JSON and other structured formats, prefer a real parser over extracting nested syntax with a regex.

Interpret positions and execution limits

Match indexes and lengths follow JavaScript string indexing, measured in UTF-16 code units rather than user-perceived characters. Emoji and combining marks can make positions look unexpected. Only the exposed flags are available; there is no Unicode-flag or sticky-flag control here. Capture columns show group values, not a complete parsing tree.

Browser matching runs in a worker with a one-second timeout, and the engine rejects results exceeding 10000 matches. These limits prevent a runaway preview from being treated as a complete successful result; they do not prove a pattern will be fast in production. Shorten the sample and simplify nested repetition when a task stops. Use Text Diff to compare test cases, Text Processor to prepare input, and JSON Formatter when the source is actually a JSON document.

FAQ

This uses JavaScript RegExp with the flags exposed on the page. PCRE, Python, and database dialects differ. Enter the pattern body without surrounding slash delimiters and retest in your target runtime.

No. A search may find only a substring. For full-value validation, design suitable anchors and test invalid cases too. Matching alone does not establish ownership, deliverability, or safety.

JavaScript indexes UTF-16 code units, not visual characters. Some emoji use multiple units, and combining sequences may contain several characters. Do not interpret indexes as grapheme counts.

The browser worker has a one-second timeout, and results are limited to 10000 matches. Simplify nested repetition or shorten input. A stopped preview is not proof that the rest of the sample has no matches.

No. It previews matches and capture groups. Use a parser for structured JSON and a separate transformation for replacement; extraction does not validate an entire document.

No. Matching runs locally in the browser. Redact private records before sharing samples with anyone else, and still test performance in the environment where the pattern will run.

Related Tools