Match results appear here
Enter a pattern and test string to see matches// test regex live in the browser
Test and debug regular expressions live in the browser. Highlight matches, capture groups, flags, and see results instantly. Free, no sign-up required.
Match results appear here
Enter a pattern and test string to see matchesType your regex in the pattern field between the slashes. Toggle flags as needed.
Paste or type the string you want to test your regex against in the left panel.
Matches highlight in real time. View detailed match data and capture groups on the right.
A Regex Tester is an interactive tool that lets you write and test regular expressions against sample text in real time. It highlights matches, extracts capture groups, and shows match positions โ all in the browser without any server calls.
This tool uses the JavaScript RegExp engine, making it ideal for frontend and Node.js developers.
This tool uses JavaScript's built-in RegExp engine, which runs entirely in your browser. It supports ECMAScript regex syntax including lookaheads, lookbehinds (ES2018+), named groups, and Unicode property escapes with the u flag.
g (global) finds all matches, not just the first. i makes matching case-insensitive. m makes ^ and $ match line boundaries. s (dotAll) makes . match newlines. u enables full Unicode support. y (sticky) matches only from the last index position.
Capture groups are portions of a pattern wrapped in parentheses (...). They extract specific sub-matches from the full match. In this tool, each match card shows the full match plus any numbered or named capture groups beneath it.
Common causes: the i flag is off and case doesn't match; the g flag is off so only the first match is found; special characters like ., *, + need escaping with \ when you mean them literally; or anchors ^ and $ require the m flag for multiline text.
No. All regex matching happens entirely in your browser using JavaScript. Your pattern and test string never leave your device. This makes the tool fast, private, and usable offline.
Escape it with a backslash: \. matches a literal period, \* matches a literal asterisk, \( and \) match literal parentheses. The special characters that need escaping are: . * + ? ^ $ { } [ ] | ( ) \
\d matches any digit 0โ9. \w matches any word character: letters, digits, and underscore. \s matches any whitespace: space, tab, newline, etc. Their uppercase versions (\D, \W, \S) match the opposite โ everything that the lowercase version does NOT match.
Yes. Use the syntax (?<name>...) to create a named group. For example, (?<year>\d{4})-(?<month>\d{2}) creates named groups year and month. Named groups appear labelled in the match results panel.
A regex tester โ short for regular expression tester โ is an interactive tool that lets you write, test, and debug regular expressions against sample text in real time. Instead of writing code, running it, and checking output manually, a regex tester gives you an immediate visual loop: type your pattern, see the matches highlighted instantly, inspect capture groups, and adjust until it's right.
This particular tool runs entirely in your browser using JavaScript's native RegExp engine. There's no server, no install, and no account needed โ just open the page and start testing.
A regular expression is a sequence of characters that defines a search pattern. The pattern is matched against a target string, and the engine returns zero or more matches. Each match can contain the full matched text plus any sub-matches captured by parentheses (called capture groups).
Regex syntax is powerful but compact. A small pattern like \b[A-Z][a-z]+\b matches any word that starts with a capital letter followed by one or more lowercase letters โ useful for finding proper nouns. A pattern like \d{4}-\d{2}-\d{2} matches dates in ISO 8601 format (YYYY-MM-DD).
Flags modify how a pattern is applied to text. The JavaScript regex engine supports six flags:
g โ Global: Find all matches, not just the first. Without this flag, the engine stops after the first match.i โ Case insensitive: Match regardless of letter case. /hello/i matches "Hello", "HELLO", and "hello".m โ Multiline: Makes ^ and $ match the start and end of each line, not just the whole string.s โ DotAll: Makes the dot . metacharacter match newline characters as well as everything else.u โ Unicode: Enables full Unicode matching and allows Unicode property escapes like \p{Letter}.y โ Sticky: Matches only at the exact position of the last match, useful for parsing sequential tokens.Capture groups let you extract specific parts of a match. Any portion of a pattern wrapped in parentheses (...) is a capturing group. For example, the pattern (\d{4})-(\d{2})-(\d{2}) on the string "2024-03-15" would yield the full match "2024-03-15" plus three capture groups: "2024", "03", and "15".
You can also use named capture groups with the syntax (?<name>...). Named groups make your regex more readable and self-documenting. The pattern (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) produces the same matches but labels them as year, month, and day.
Non-capturing groups use (?:...). They group parts of a pattern without creating a capture, which is useful for applying quantifiers to a group without extracting the text.
\d+ โ One or more digits (0โ9)\w+ โ One or more word characters (letters, digits, underscore)\s+ โ One or more whitespace characters[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,} โ Email addresshttps?://[^\s]+ โ HTTP or HTTPS URL(\d{1,3}\.){3}\d{1,3} โ IPv4 address\b\w+\b โ Whole word (word boundary on each side)^.+$ โ Non-empty line (with m flag for multiline)Quantifiers control how many times a part of a pattern can match:
* โ Zero or more times+ โ One or more times? โ Zero or one time (makes the preceding token optional){n} โ Exactly n times{n,} โ n or more times{n,m} โ Between n and m timesBy default, quantifiers are greedy โ they match as much text as possible. Adding ? after a quantifier makes it lazy, matching as little as possible. For example, <.+> on <b>bold</b> matches the whole string, while <.+?> matches just <b>.
Anchors match positions in the string rather than characters. ^ matches the start of the string (or line with the m flag), and $ matches the end. \b matches a word boundary โ the position between a word character and a non-word character. Word boundaries are extremely useful for finding whole words: \bcat\b matches "cat" in "the cat sat" but not in "concatenate".
Debugging regular expressions in production code is slow and frustrating. Every change requires re-running your code, checking output, and iterating. An online regex tester collapses that loop to near-zero: change a character, see the result instantly. This makes learning regex dramatically faster, and it makes debugging complex patterns far less painful.
Because this tool uses the same JavaScript RegExp engine as browsers and Node.js, patterns tested here will behave identically in your JavaScript code. No translation or syntax differences to worry about.
g flag ensures you see all matches, not just the first.., *, +, ?, (, ), [, ], {, }, ^, $, |, and \ have special meaning and must be escaped with \ when you need to match them literally.[aeiou] matches any vowel; [^aeiou] matches any non-vowel. Ranges like [a-z] are compact and readable.(?<year>\d{4}) is far more readable six months later than (\d{4}).