Test Your Knowledge
Regular Expression Tester
Test and debug regular expressions in real-time. Useful for input validation, pattern matching, and security testing. All processing happens in your browser.
/
/
Results
Regex Quick Reference
Character Classes
| Pattern | Description |
|---|---|
. | Any character except newline |
\d | Digit (0-9) |
\D | Non-digit |
\w | Word character (a-z, A-Z, 0-9, _) |
\W | Non-word character |
\s | Whitespace (space, tab, newline) |
\S | Non-whitespace |
[abc] | Any of a, b, or c |
[^abc] | Not a, b, or c |
[a-z] | Range a to z |
Quantifiers
| Pattern | Description |
|---|---|
* | 0 or more |
+ | 1 or more |
? | 0 or 1 |
{n} | Exactly n times |
{n,} | n or more times |
{n,m} | Between n and m times |
*? | 0 or more (non-greedy) |
+? | 1 or more (non-greedy) |
Anchors & Boundaries
| Pattern | Description |
|---|---|
^ | Start of string/line |
$ | End of string/line |
\b | Word boundary |
\B | Non-word boundary |
Groups & Lookaround
| Pattern | Description |
|---|---|
(abc) | Capturing group |
(?:abc) | Non-capturing group |
(?=abc) | Positive lookahead |
(?!abc) | Negative lookahead |
(?<=abc) | Positive lookbehind |
(? | Negative lookbehind |
\1 | Backreference to group 1 |
Security Validation Patterns
| Use Case | Pattern |
|---|---|
| Email (basic) | ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ |
| Username (alphanumeric) | ^[a-zA-Z0-9_]{3,20}$ |
| UUID v4 | ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ |
| Hex Color | ^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$ |
| SQL Injection Detection | ('|"|;|--|\b(OR|AND)\b.*=) |
| XSS Detection | <[^>]*(script|on\w+\s*=)[^>]*> |
Note: Regex alone is not sufficient for security validation. Always use proper input sanitization libraries and parameterized queries.
Related Resources
FixTheVuln Store
Studying for CompTIA Security+? Get the Study Planner
Fillable PDF study planners with domain trackers, weekly schedules, and progress tracking. Available in Standard, ADHD-Friendly, Dark Mode, and 4-Format Bundle.
CompTIA Security+ Planner60+ certifications available — from $5.99