Regex Tester
A free online tool to test regular expressions in real time and check match results
Regular Expression
//
Test String
Match Results 0 Match
Enter a regular expression and test string to see results here.
Basic Syntax
| . | Any character (except newline) |
| ^ | Start of string/line |
| $ | End of string/line |
| \b | Word boundary |
| \d | Digit [0-9] |
| \w | Word character [a-zA-Z0-9_] |
| \s | Whitespace character |
Quantifiers
| * | 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 |
| *?, +? | Lazy quantifier |
Groups & References
| (abc) | Capture group |
| (?:abc) | Non-capture group |
| (?<name>) | Named group |
| \1 | Backreference |
| a|b | Alternation (OR) |
| [abc] | Character class |
| [^abc] | Negated character class |
Common Patterns
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
https?://[^\s/$.?#].[^\s]*
\d{2,3}-\d{3,4}-\d{4}
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
\d{4}[-/.]\d{2}[-/.]\d{2}
#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})
What is a Regex Tester?
A regular expression (regex) is a powerful tool for searching, extracting, and replacing specific patterns in strings. With this online regex tester, you can write and test regular expressions in real time and visually inspect the match results. All processing is done in the browser, so no data is sent externally.
How to Use
- Enter a regular expression in the input field at the top.
- Click the flag buttons (g, i, m, s, u) to set options.
- Enter text to test in the test string area and match results will be displayed in real time.
- Expand the replace section to use the string replacement feature.
Frequently Asked Questions
No. All processing is done in the browser's JavaScript engine, and neither the regular expressions nor the test strings you enter are sent to any external server. You can use it with confidence.
g (global) finds all matches, not just the first. i (case-insensitive) ignores case. m (multiline) makes ^ and $ match the start and end of each line. s (dotAll) makes . match newline characters as well. u (unicode) enables full Unicode support.
$1, $2, etc. refer to values matched by capture groups (parts enclosed in parentheses) in the regular expression. For example, in the regex (\w+)@(\w+), $1 represents the string before @, and $2 represents the string after @. You can use these to rearrange matched parts into a desired format.
This tool uses the browser's JavaScript regex engine. JavaScript regex is compatible with most programming languages, but some advanced features (e.g., lookbehind, atomic groups) may vary in support depending on the browser.
