We use cookies to understand how DevToolsHub is used and to improve your experience. You can choose which types of cookies to allow.
Test regular expressions with live match highlighting and groups.
Loading...
Loading...
A Regex Testeris an interactive tool that lets you write, test, and debug regular expressions in real time. You enter a pattern, provide a test string, and the tool instantly highlights every match, shows capture group values, and reports match positions β all without leaving your browser. It's the fastest way to experiment with regex syntax and verify that your patterns behave the way you expect.
Regular expressions (regex or regexp) are a powerful mini-language for describing text patterns. They're used across virtually every programming language, text editor, and command-line tool for tasks like input validation (is this email address valid?), data extraction (pull all URLs from an HTML document), search and replace (normalize phone number formats), and parsing (split log lines into structured fields). Regex is supported natively in JavaScript, Python, Java, Go, Rust, Perl, grep, sed, awk, and dozens of other environments.
However, regex syntax is notoriously dense and error-prone. A single misplaced quantifier, missing backslash, or unbalanced parenthesis can completely change what your pattern matches β or cause it to throw a syntax error. Testing regex inline in your code means writing test cases, running your application, and reading console output. A dedicated regex tester eliminates that friction: you type a pattern, see matches highlighted instantly, and iterate until the pattern is correct.
Common use cases for an online regex tester include: validating email addresses, phone numbers, and postal codes; extracting data from structured text like log files or CSV rows; finding and replacing specific patterns across a document; testing URL routing patterns; parsing query strings; matching hashtags or mentions in social media text; and verifying that your regex works before deploying it to production code. Whether you're a beginner learning regex syntax or an experienced developer fine-tuning a complex pattern, a tester gives you immediate visual feedback that dramatically speeds up the development process.
\b(\w+)@(\w+)\.(\w+)\b. The pattern is tested live as you type.g flag finds all matches; i makes matching case-insensitive; m enables multiline mode; s allows . to match newlines; u enables Unicode mode; and y enables sticky matching.$1, $2, etc.$1, $2 for groups or $& for the full match, and see the output preview instantly. Use the Copy result button to copy the replaced text.Character classes match a single character from a set. Use square brackets to define custom sets, or shorthand escapes for common categories.
[abc]Any one of a, b, or c[^abc]Any character except a, b, or c[a-z]Any lowercase letter a through z[a-zA-Z0-9]Any alphanumeric character\dAny digit (equivalent to [0-9])\DAny non-digit character\wAny word character (letters, digits, underscore)\WAny non-word character\sAny whitespace (space, tab, newline)\SAny non-whitespace character.Any character except newline (with s flag, includes newline)Quantifiers specify how many times the preceding element must appear. Append ? to make any quantifier lazy (match as few as possible).
*Zero or more occurrences+One or more occurrences?Zero or one occurrence (optional){n}Exactly n occurrences{n,}At least n occurrences{n,m}Between n and m occurrences*?Lazy: zero or more (fewest possible)+?Lazy: one or more (fewest possible)Groups let you combine multiple elements and capture matched substrings. Non-capturing groups match but don't store the result. Lookahead and lookbehind assertions check for (or against) a pattern without consuming input.
(abc)Capturing group β stores matched text(?:abc)Non-capturing group β matches but doesn't store(?=abc)Positive lookahead β matches if abc follows(?!abc)Negative lookahead β matches if abc doesn't follow(?<=abc)Positive lookbehind β matches if abc precedes(?<!abc)Negative lookbehind β matches if abc doesn't precede(?<name>x)Named capturing group β access by name\1Backreference to the first capturing groupAnchors match positions within the string rather than actual characters. They're zero-width assertions.
^Start of string (or line with m flag)$End of string (or line with m flag)\bWord boundary β between a word char and non-word char\BNot a word boundaryFlags modify how the regex engine interprets the pattern and performs matching. Combine multiple flags for compound behavior.
gGlobal β find all matches, not just the firstiCase insensitive β ignore letter casemMultiline β ^ and $ match per line, not just string boundariessDotall β . matches newline charactersuUnicode β treat pattern and string as Unicode code pointsySticky β match only at lastIndex position$1, $2, etc., so you can verify what each group captures.$1, $&, and other replacement tokens. Copy the result with one click.g, i, m, s, u, and y flags individually with user-friendly switches.RegExp engine. Your data never leaves your device.Loading...