Enter a pattern and test string to start
A regular expression (regex) is a pattern that describes a set of strings. It defines rules — characters to match, repetitions, alternatives, anchors — and the engine checks whether and where the pattern occurs in the input. Once you internalize the syntax, regex becomes one of the most expressive and portable tools in a developer's toolbox.
| Pattern | Meaning | Example match |
|---|---|---|
| . | Any character except newline | a, 5, @ |
| \d | Digit [0-9] | 3, 7 |
| \w | Word char [a-zA-Z0-9_] | a, Z, _ |
| \s | Whitespace (space, tab, newline) | (space) |
| ^ | Start of string (or line with m flag) | |
| $ | End of string (or line with m flag) | |
| * | 0 or more repetitions (greedy) | aaa, (empty) |
| + | 1 or more repetitions (greedy) | aaa |
| ? | 0 or 1 repetition (optional) | a, (empty) |
| {n,m} | Between n and m repetitions | aa, aaa |
| (abc) | Capture group | abc |
| (?:abc) | Non-capturing group | abc (not captured) |
| (?<name>abc) | Named capture group | groups.name = abc |
| [a-z] | Character class (range) | a, b, z |
| [^abc] | Negated class (not a, b, or c) | d, 5, @ |
| a|b | Alternation (a or b) | a, b |
g — global: find all matches, not just the firsti — case-insensitive: Hello matches hellom — multiline: ^ and $ match start/end of each lines — dotAll: . also matches newlinesu — unicode: enables proper Unicode matching (needed for emoji, CJK, \p{} properties)^[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}$^(\d{1,3}\.){3}\d{1,3}$^\d{4}-\d{2}-\d{2}$^[a-z0-9]+(?:-[a-z0-9]+)*$"(\w+)":\s*"([^"]+)"All matching runs locally in your browser using the native JS RegExp engine.