Type a regular expression and paste your test string to see matches highlighted in real time. Inspect capture groups and match positions. Runs entirely in your browser โ nothing is sent to any server.
Need regex find-and-replace directly in your browser on any text you're working with? TextForge runs as a Chrome extension โ paste text, apply regex, extract or transform results, all locally.
Try TextForge โ freeClick any pattern to load it into the tester above. Then paste your own text to see it in action.
A condensed reference for the most-used regular expression syntax. All patterns in this tester follow JavaScript's ECMAScript regex engine.
| Token | Meaning | Example |
|---|---|---|
| . | Any character except newline (add s flag to match newlines) | c.t โ "cat", "cut" |
| \d | Any digit 0โ9 | \d\d\d โ "404" |
| \w | Word character [a-zA-Z0-9_] | \w+ โ "hello_world" |
| \s | Whitespace (space, tab, newline) | \s+ โ gaps between words |
| \b | Word boundary | \bcat\b matches "cat" not "catch" |
| ^ | Start of string (or line with m flag) | ^\d โ line starting with a digit |
| $ | End of string (or line with m flag) | \d$ โ line ending with a digit |
| * | 0 or more (greedy) | ab* โ "a", "ab", "abbb" |
| + | 1 or more (greedy) | ab+ โ "ab", "abbb" (not "a") |
| ? | 0 or 1 (optional) | colou?r โ "color" or "colour" |
| {n,m} | Between n and m times | \d{2,4} โ 2 to 4 digits |
| [abc] | Character class (any of a, b, c) | [aeiou] โ any vowel |
| [^abc] | Negated class (anything except a, b, c) | [^\d] โ non-digit |
| (abc) | Capture group โ stored as $1, $2โฆ | (\d{4})-(\d{2}) โ two groups |
| (?:abc) | Non-capturing group | (?:foo|bar)baz |
| a|b | Alternation (a or b) | cat|dog |
| *? +? | Lazy quantifier (shortest match) | <.+?> matches first tag only |
| Flag | Name | Effect |
|---|---|---|
| g | Global | Find all matches, not just the first |
| i | Case insensitive | Hello matches "hello", "HELLO", "HeLLo" |
| m | Multiline | ^ and $ match start/end of each line, not just the whole string |
| s | Dot-all | . matches newline characters too |