Tarayıcınız güncel değil

Bu siteyi görüntülemek için tarayıcınızın veya cihazınızın işletim sisteminin güncellenmesi gerekiyor.

Your browser is out of date. Please update iOS or your browser to view this site.

Skip to main content
Gizke.com
Blog

Regex Tester

Runs on your device. Nothing is sent.

Flags

Common patterns

Test string

No matches found

Explanation

Type a pattern above to see a breakdown of what each part does

Test, explain, and debug JavaScript regular expressions with live match highlighting, entirely in your browser.

A regular expression (regex) is a pattern used to match, find, or replace text - the same underlying tool that powers search-and-replace in code editors, form validation, and log parsing. This tester runs JavaScript's native regex engine directly in your browser: type a pattern and a test string, and it highlights every match, breaks capture groups apart, previews replacements, and explains what each part of the pattern does in plain language. Nothing you type is ever uploaded anywhere.

Frequently asked questions

Which regex flavor does this use?
JavaScript's built-in regex engine (the one behind RegExp and String.prototype.match/replace), since everything here runs client-side in your browser rather than on a server. It's very close to PCRE but has a few differences - for example, lookbehind support depends on the engine version, and named groups use (?<name>...) syntax.
Why does my pattern only match once?
By default, without the g (global) flag, a regex stops after its first match - this mirrors how RegExp.exec() and String.match() actually behave in JavaScript. Enable the g flag above to find every match in the test string instead of just the first one.
What's the difference between (...) and (?:...)?
Both group parts of a pattern together, but only (...) - a capturing group - saves what it matched so you can reference it later (as $1, $2, ... in a replacement, or in the match's group list). (?:...) is a non-capturing group: it groups and applies quantifiers without keeping the match around, which is useful when you need grouping but don't care about the captured text.
How do named groups and $<name> replacements work?
Write (?<name>...) instead of (...) to capture a group under a name instead of just a number. In Replace mode, refer to it in the replacement text as $<name> - for example, (?<year>\d{4})-(?<month>\d{2}) replaced with $<month>/$<year> rearranges a date without needing to remember group numbers.
What's the difference between a greedy and a lazy quantifier, like + versus +??
A greedy quantifier (+, *, {2,4}) matches as much as it possibly can, then backs off only if needed to let the rest of the pattern match. A lazy quantifier - the same symbol followed by ? - matches as little as possible instead, expanding one character at a time only when required. For example, <.+> against <a><b> greedily matches the whole <a><b>, while <.+?> lazily matches just <a>.
What do lookahead and lookbehind actually check, if they don't consume any characters?
They test whether a pattern appears immediately before or after the current position without including it in the match itself - so (?=...) and (?<=...) check ahead/behind for something that must be there, while (?!...) and (?<!...) check that it must not be there. That's why you can use \d+(?=px) to match a number only when it's followed by 'px', while 'px' itself never shows up in the matched text.
For developers: open this page with `q` (the pattern) and `text` (the test string) parameters in the URL - e.g. gizke.com/regex?q=\d+&text=There are 42 apples - and both are pre-filled automatically. Most visitors won't need this; it's meant for linking directly to a ready-to-use example.

Share this tool

BlogAboutContactTerms of UsePrivacy Policy