Regex Tester: build and debug patterns against your own text
A regular expression is a tiny language for describing the shape of text. Instead of asking "is this exact word here?", a regex lets you ask "is there a string that looks like this?" That is what makes it powerful for finding, validating, extracting, and replacing text in code editors, log files, form inputs, and scripts. It is also what makes it easy to get wrong, because a pattern that reads fine in your head can quietly match too much, too little, or nothing at all.
This is why testing interactively beats guessing. When you type a pattern and watch matches light up across real sample text, you get instant feedback: you see what was caught, what slipped through, and which capture group grabbed which piece. Our Regex Tester runs entirely in your browser. Your pattern and your sample text never leave the page, so you can paste log lines, emails, or production data without sending anything to a server.

The building blocks worth knowing
Most everyday patterns are assembled from a small set of pieces. Learn these and you can read the majority of regexes you meet in the wild.
Character classes describe a set of allowed characters. [aeiou] matches any single vowel, [0-9] matches one digit, and [a-zA-Z] matches one letter. A caret inside the brackets negates the set, so [^0-9] means "any character that is not a digit." Shorthands save typing: \d is a digit, \w is a word character (letters, digits, underscore), \s is whitespace, and the dot . matches almost any single character.
Quantifiers say how many times the previous piece may repeat. * means zero or more, + means one or more, and ? means zero or one (optional). For exact counts, {3} means exactly three and {2,4} means two to four. So \d{4} matches a four-digit year and colou?r matches both spellings.
Anchors pin a pattern to a position rather than a character. ^ matches the start of the text, $ matches the end, and \b marks a word boundary. The pattern ^Error only matches lines that begin with "Error", which is exactly what you want when scanning logs.
Groups wrap part of a pattern in parentheses, both to apply a quantifier to several characters at once and to capture the matched text for reuse. In (\d{4})-(\d{2})-(\d{2}) each group captures a date component you can pull out later. Alternation with the pipe acts like "or": cat|dog|fish matches any one of the three words.
Patterns you will actually reach for
A few recurring jobs cover most real work. To catch something email-ish, [\w.+-]+@[\w-]+\.[\w.-]+ is a pragmatic starting point; full email validation per the formal spec is famously gnarly, and a loose pattern is usually the right call for highlighting candidates rather than rejecting users.
For numbers, \d+ grabs runs of digits, while -?\d+(\.\d+)? matches optional negatives and decimals. To trim leading and trailing whitespace, match ^\s+|\s+$ and replace it with nothing. To find duplicated words, the backreference pattern \b(\w+)\s+\1\b matches a word followed by itself, where \1 refers back to the first captured group.

Flags change how matching behaves
Flags are switches that modify the whole pattern. The global flag (g) finds every match instead of stopping at the first, which is what you want when highlighting all occurrences. The case-insensitive flag (i) makes error match "Error" and "ERROR" alike. The multiline flag (m) changes ^ and $ so they match at the start and end of every line, not just the whole text, which is essential for line-by-line log work. Other useful flags include s (dotall, letting the dot match newlines) and u for full Unicode handling.
Flavors differ slightly by language
Regex is a family of dialects, not one fixed standard. JavaScript, Python, PCRE (PHP), Java, .NET, Go, and Rust agree on the core syntax above, but they diverge at the edges: lookbehind support, named-group syntax ((?<name>...) versus (?P<name>...)), Unicode property escapes, and which flags exist all vary. A pattern that works in one engine may need a small tweak in another, so it pays to test against the flavor you actually ship with. When you have a pattern dialed in, our other developer tools and text tools can help with the surrounding work of cleaning, encoding, and transforming the data you just matched.
Frequently asked questions
Is my text sent to a server?
No. The Regex Tester runs entirely in your browser. Your pattern and sample text stay on your device and are never uploaded, so it is safe to paste sensitive data.
Which regex flavor does this tool use?
It uses the JavaScript regex engine built into your browser. The core syntax matches what you know from most languages, though some advanced features differ slightly from PCRE, Python, or .NET.
What is the difference between greedy and lazy matching?
By default quantifiers are greedy and grab as much text as possible. Adding a question mark makes them lazy, so they grab as little as possible. For example, the pattern a dot star is greedy while a dot star question mark is lazy.
How do I match a literal special character?
Escape it with a backslash. To match an actual dot, write backslash dot. The same applies to other meta characters such as parentheses, brackets, the plus sign, and the question mark.
Why does my pattern match nothing?
Common causes are a missing global flag, anchors that pin the match to the wrong position, an unescaped special character, or greedy quantifiers overrunning the boundary you expected. Test piece by piece to find the culprit.
Can I capture parts of the match?
Yes. Wrap a section of the pattern in parentheses to create a capture group. Each group is reported separately, which lets you extract fields such as the year, month, and day from a date.
