Regex Reference
A quick reference guide for regular expression syntax — character classes, anchors, quantifiers, groups, flags, and common patterns.
Character Classes
Anchors
Quantifiers
Groups & Alternation
Escapes & Special
Flags
Common Patterns
About This Tool
Regular expressions (regex) are a powerful language for describing patterns in strings. This reference covers the most commonly used syntax and patterns.
Sections are organized by category. Use the search box to instantly filter patterns by keyword.
How to Use
- Browse sections to find the syntax you need.
- Use the search box to filter by keyword.
- Click any pattern to copy it to the clipboard.
- Test patterns in the Regex Tester tool.
Use Cases
Useful for form validation, string parsing, log analysis, search-and-replace, and many other programming tasks.
FAQ
- Does regex syntax work in all languages? — Most languages support regex but with minor syntax differences. Major languages like JavaScript, Python, and Java follow PCRE-compatible syntax.
- How do I make a pattern case-insensitive? — Add the i flag after the pattern. Example: /pattern/i
- What is the difference between greedy and lazy quantifiers? — Greedy quantifiers (*, +, ?) match as much as possible; lazy quantifiers (*?, +?, ??) match as little as possible.