Regex Tester

Test regular expressions with live match highlighting, capture group extraction, and common pattern presets. Runs in your browser, nothing sent to a server.

100% client-side. Your data never leaves your browser.

//g

Converters & Examples

Related Tools

Regex Tester

A regular expression (regex) is a pattern that describes a set of strings. Regex is used in search, text validation, parsing, and find and replace operations across virtually every programming language. Enter a pattern and test string below to see matches highlighted in real time, with capture groups and named groups extracted automatically.

How to Use

  1. Type a regex pattern in the pattern field, or pick a preset (Email, URL, IPv4, etc.)
  2. Toggle flags as needed. Global (g) is on by default so you see all matches
  3. Enter or paste your test string. Matches highlight instantly
  4. Click a match card to expand capture group details
  5. Copy the full regex literal or individual match values

Understanding Regex Syntax

Every regex is built from two kinds of pieces: literal characters that match themselves, and metacharacters that match patterns. The metacharacter \d matches any digit, \w matches any word character (letters, digits, underscore), and \s matches whitespace. Quantifiers control repetition: + means one or more, * means zero or more, {3} means exactly three, and {2,5} means between two and five.

Anchors like ^ (start of string) and $ (end of string) do not consume characters but assert a position. With the multiline flag enabled, they match line boundaries instead. Lookaheads (?=...) and lookbehinds (?<=...) are zero width assertions that check for a pattern without including it in the match.

Character classes [abc] match any one of the listed characters. Ranges like [a-z] match any lowercase letter. Negation [^abc] matches anything except the listed characters.

Performance Considerations

Certain patterns cause catastrophic backtracking, where the engine takes exponential time on input that does not match. The classic example is (a+)+$ tested against a string of a’s with no line ending. Avoid nested quantifiers on the same characters. If your pattern takes noticeably long, simplify it or use atomic groups/possessive quantifiers (not available in JavaScript regex, but achievable through pattern restructuring).

Need to work with a matched URL? Send it to the URL Encoder for encoding. If a match returns JSON, the JSON Formatter can format it. Use the Diff Checker to compare regex output across different test strings.