Which regex flavor is this?
JavaScript regular expressions, the same RegExp your browser uses. Flags default to g. Other engines, such as PCRE, can differ.
Runs in your browser. No signup required.
The pattern box and the flags box are handed to new RegExp. The flags start as g. An empty pattern compiles nothing and the sample sentence is shown unmarked. A pattern that throws, including a trailing backslash or a bad group, prints the JavaScript error and matches nothing until you fix it. The flavor is the one your browser ships. A PCRE recipe from a server log can disagree on lookbehind, Unicode properties, or recursion.
With g, matches are collected with matchAll and the highlight replaces every match. Without g, the match list keeps only the first match, and the highlight replaces the first one. The sample text is “The quick brown fox jumps over the lazy dog.” A pattern of \b\w{5}\b with the g flag marks the five-letter words.
Paste a few lines from the log or the document, not the entire file, and iterate on the pattern. The highlight wraps matches in a mark element in the preview string. It does not edit your source file. Capture groups are not listed separately; the match list shows the full match text, match[0]. If you need group 1, adjust the pattern so the whole match is the part you care about, or test that part in your own code.
Flags you can type include i, m, s, u, and the others your browser accepts. An illegal flag is an error from the RegExp constructor, shown in the same banner. The word counter is a better tool when you only need a length. This page is for “does this pattern hit.”
The search runs on the main thread. Nested quantifiers against a long line, the classic catastrophic-backtracking case, can freeze the tab until the engine finishes or the browser kills it. Shorten the sample before you try a suspicious pattern. There is no timeout and no worker.
Replacing the sample does not escape HTML in the highlight path beyond what the match wrapper adds, so treat the preview as a tester, not as a sanitizer. The text never leaves the browser. Clear both boxes if the sample was a customer record.
The pattern and the flags are passed to new RegExp. The flags box starts as g. An empty pattern matches nothing and leaves the sample unmarked. With g, the match list is every full match from matchAll. Without g, the list keeps only the first match from String.match. Capture groups are not listed. The text in the list is match[0], the whole match.
On the sample sentence “The quick brown fox jumps over the lazy dog.” the pattern \b\w{4}\b with g finds over and lazy. The same pattern without g finds only over. The pattern fox|dog with g finds fox and then dog. Five-letter words are a different pattern. quick, brown, and jumps are five letters, so a four-letter boundary pattern does not mark them.
A pattern that throws does not highlight and does not list matches. The banner is the exception text. An unclosed parenthesis, the pattern (, is an unterminated group. In V8, the engine in Chrome, the message is Invalid regular expression: /(/g: Unterminated group. Firefox can word the same failure differently. The flavor is the browser you have open, not PCRE.
An illegal flag fails the same way. Lookbehind and Unicode property escapes work only when this browser supports them. A recipe copied from a server log can disagree. Shorten the sample before you try nested quantifiers. The search runs on the main thread, and there is no timeout.
Matches are wrapped in a mark element in the preview string. That preview is for reading the hits. It is not an HTML sanitizer, and it does not edit a file on disk. Paste a few lines, not a whole export, especially if the text is a customer record. Clear the boxes when you are done. Nothing is uploaded.
The word counter is the neighbor when you only need a length. This page answers whether a pattern hits, and which full matches it produced under the flags you typed.
The line Room 12 and room 3, with the pattern \d+ and the g flag, lists 12 and 3. The same line with the pattern room and the flags gi lists Room and then room, because i ignores case and g keeps every full match. Drop the i flag and room matches only the lowercase word. The highlight wraps those hits. It does not invent a separate list of capture groups.
An empty pattern still matches nothing, even when the flags box says g. Fix the pattern before you read a highlight into a bug report. The sample sentence is only a default. Replace it with the line you actually need to test, then clear it if that line was private.
Type your expression into Pattern.
Set the Flags, for example gmi.
Paste the text to search into Test text.
Read the matches in Highlighted matches and the list under Matched values. An invalid pattern shows an error.
JavaScript regular expressions, the same RegExp your browser uses. Flags default to g. Other engines, such as PCRE, can differ.
The error from the JavaScript parser is shown. Nothing is matched until the pattern compiles.
Yes. The test runs on this tab. A pattern with catastrophic backtracking can make the page unresponsive. Try a shorter sample first.
No. Matching stays in the browser.
No. The match list shows the full match text. With the g flag that is every match; without it, only the first.
The RegExp in your browser. Patterns written for PCRE or another server engine can behave differently, especially around Unicode and lookbehind.
With the g flag, over and lazy. Without g, only over. quick, brown, and jumps are five letters, so a four-letter pattern does not include them.
Two when the g flag is on: fox and then dog. Without g, the list keeps only the first full match.