Regex Tester
Test and debug regular expressions in real-time — with match highlighting
How to Use the Regex Tester
- Enter your regular expression in the pattern field.
- Paste test text in the input area.
- Matches are highlighted in real-time as you type.
- Toggle flags: g (global), i (case-insensitive), m (multiline), s (dotall).
Quick regex reference
\d— digit (0-9)\w— word character (a-z, A-Z, 0-9, _)\s— whitespace+— one or more*— zero or more?— zero or one^— start of line$— end of line[abc]— character class(group)— capture group
What is a Regular Expression?
A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regex engines use these patterns to find, match, replace, or split strings. They are supported natively in virtually every programming language and are essential for text processing, validation, and parsing tasks.
Common Uses
- Form validation — validate email addresses, phone numbers, postcodes
- Log parsing — extract timestamps, error codes, and IP addresses from logs
- Find and replace in code editors and terminal (grep, sed, awk)
- URL routing — matching dynamic path segments in web frameworks
Frequently Asked Questions
What does .* mean in regex?
. matches any single character except newline. * means zero or more of the preceding element. So .* means "match any characters, any number of times" — essentially a wildcard for an entire section of text.
What is the difference between greedy and lazy matching?
Greedy matching (default) matches as much text as possible. Lazy matching (add ? after a quantifier, e.g. .*?) matches as little as possible. For example, <.+> on "hello" — greedy returns the whole string, lazy returns just "".
How do I test a regex for email validation?
A basic email regex is: ^[^\s@]+@[^\s@]+\.[^\s@]+$ — paste it into the pattern field and test with valid and invalid emails. Note that fully RFC 5322-compliant email validation via regex is extremely complex — for production use, validate via DNS or a sending attempt instead.