Matches
0 found
Highlighted matches will appear here...
Anchors
| Anchor | Description | Example | Matches |
|---|---|---|---|
| ^ | Start of string or line | ^Team | "Team" at start |
| $ | End of string or line | end$ | "end" at end |
| \b | Word boundary | \bword\b | whole word only |
| \B | Not word boundary | \Bend | "end" inside word |
Character Classes
| Class | Description | Equivalent |
|---|---|---|
| \d | Digit | [0-9] |
| \D | Not a digit | [^0-9] |
| \w | Word character | [a-zA-Z0-9_] |
| \W | Not a word character | [^a-zA-Z0-9_] |
| \s | Whitespace | [ \t\n\r\f\v] |
| \S | Not whitespace | [^ \t\n\r\f\v] |
| . | Any character (except newline) | - |
| [abc] | Any of a, b, or c | - |
| [^abc] | Not a, b, or c | - |
| [a-z] | Range: a to z | - |
Quantifiers
| Quantifier | Description | Example |
|---|---|---|
| * | 0 or more | a* |
| + | 1 or more | a+ |
| ? | 0 or 1 | colou?r |
| {n} | Exactly n | \d{4} |
| {n,} | n or more | \d{2,} |
| {n,m} | Between n and m | \d{2,4} |
| *? | 0 or more (lazy) | a*? |
| +? | 1 or more (lazy) | a+? |
Groups & References
| Syntax | Description | Example |
|---|---|---|
| (...) | Capturing group | (abc) |
| (?:...) | Non-capturing group | (?:abc) |
| (?<name>...) | Named capturing group | (?<year>\d{4}) |
| \1, \2 | Backreference | (a)\1 |
| a|b | Alternation (or) | cat|dog |
Assertions (Lookahead/Lookbehind)
| Assertion | Description | Example |
|---|---|---|
| (?=...) | Positive lookahead | foo(?=bar) |
| (?!...) | Negative lookahead | foo(?!bar) |
| (?<=...) | Positive lookbehind | (?<=foo)bar |
| (?<!...) | Negative lookbehind | (?<!foo)bar |
Flags
| Flag | Description |
|---|---|
| g | Global - find all matches, not just the first |
| i | Case-insensitive matching |
| m | Multiline - ^ and $ match line boundaries |
| s | Dotall - . matches newlines too |
| u | Unicode - enables full Unicode support |
How it works
Enter a regular expression pattern and test string to see matches highlighted in real-time. Toggle regex flags to modify matching behavior.
Tips:
-
Use the
gflag to find all matches instead of just the first one - Click on a match in the results to see its position and capture groups
- The cheatsheet tab provides a quick reference for common regex syntax
- This tool uses JavaScript's RegExp engine, which supports most common regex features
Want to learn more?
Read the complete guide with examples and tips
Related developer tools
Continue with nearby tasks in the developer tools hub.
Developer
JSON Format/Validate
Format, validate, and beautify JSON with syntax highlighting
Open tool
Text
Text Diff
Compare two texts and highlight differences
Open tool
Text
Find and Replace
Find and replace text with optional regex support
Open tool
Developer
URL Encode/Decode
Encode or decode URL components and query strings
Open tool
Developer
HTML Entity Encode/Decode
Encode or decode HTML entities and special characters
Open tool
Text
String Obfuscator
Mask secrets while keeping them identifiable
Open tool