Free online regex tester and debugger. Test regular expressions against sample text with real-time match highlighting. Supports flags: g, i, m, s.
Regular expressions (regex) are patterns used to match, search, validate, and manipulate text. They are supported in virtually every programming language and are essential for tasks like form validation, log parsing, data extraction, and search-and-replace operations.
This free online regex tester lets you build and debug regular expressions in real time with immediate visual feedback. Matches are highlighted as you type, so you can see exactly what your pattern matches — and what it misses — without writing any code.
The tester supports all standard JavaScript regex syntax including character classes, quantifiers, groups, lookaheads, lookbehinds, and backreferences. It also supports all common flags: g (find all matches), i (case-insensitive), m (multiline anchors), and s (dot matches newlines).
Regex can be notoriously difficult to debug — a single misplaced character changes the entire match behaviour. This tool makes the iteration cycle fast: tweak the pattern, see the result immediately, and understand exactly why a match succeeded or failed.
A regular expression (regex) is a sequence of characters that defines a search pattern. It can describe anything from a simple word to a complex structure like an email address or URL. Regex is supported in JavaScript, Python, Java, PHP, Ruby, and most other programming languages.
This tester supports the standard JavaScript regex flags: g (global — find all matches, not just the first), i (case-insensitive matching), m (multiline — makes ^ and $ match line boundaries), and s (dotAll — makes the dot . match newline characters too).
. matches any character except newline (with the s flag it matches newlines too). * means "zero or more", so .* matches any sequence including empty strings. + means "one or more", so .+ requires at least one character. Use .* when the match can be absent, .+ when at least one character is required.
Enable the i flag. With the i flag, the pattern [a-z] matches both lowercase and uppercase letters. The flag applies to the entire pattern — you cannot make only part of a regex case-insensitive using the flag.
A capture group is a part of the regex surrounded by parentheses ( ). Whatever the group matches is "captured" and can be referenced later in a replacement string or extracted by your code. For example, (\d{4}) captures exactly 4 digits.
Greedy quantifiers (*, +, {n,}) match as much as possible. Lazy quantifiers (*?, +?, {n,}?) match as little as possible. For example, .* on the string "aXbXc" matches the entire string greedily, but .*? matches just "a" lazily before stopping at the first X.
Special regex characters (. * + ? ( ) [ ] { } ^ $ | \) must be escaped with a backslash to match literally. So \. matches a literal dot, \( matches a literal opening parenthesis. Without the backslash, . matches any character.
This is usually a greedy quantifier issue. Try adding ? after *, +, or {n,} to make them lazy. Also check your anchors — without ^ and $ anchors, patterns can match substrings anywhere in the input rather than requiring a full-string match.