Regex tester: regular expressions online with explanation
Regular expressions (regex) are search patterns that allow finding, validating, and transforming text with precision. They are a fundamental tool in programming, data analysis, and system administration.
Basic regex syntax
- . — any character except newline.
- \d — digit (0-9); \w — word character (a-z, A-Z, 0-9, _).
- * — zero or more; + — one or more; ? — zero or one.
- {n,m} — between n and m repetitions.
- ^start — start anchor; end$ — end anchor.
- [abc] — character class; [^abc] — negation.
Most important flags
g (global): finds all matches, not just the first. i (insensitive): ignores case. m (multiline): ^ and $ apply to each line. s (dotAll): dot also matches newlines.
Common use cases
Validation of emails, URLs, and phone numbers. Extracting data from logs. Advanced search and replace in code editors. Text analysis and natural language processing. Parsing custom formats.