FAQ
What do the g, i, m, s and u flags do?
g matches globally, i ignores case, m makes ^ and $ match each line, s lets the dot match newlines, and u enables Unicode mode.
How do I see captured groups?
The match list shows the groups for each match; expand one to see what groups 1, 2 and so on captured.
How do I control greedy versus lazy?
Quantifiers are greedy by default. Add a question mark to make them lazy, so .*? stops earlier than .*.
Why do the counts stop at 5000 matches and 2000 highlights?
To keep large inputs responsive: the list counts at most 5000 matches and highlights at most 2000, and the status bar says so when a cap is hit. Confirm the real total with matchAll in code.
About this tool
The engine is the browser's own JavaScript RegExp (ECMAScript), not PCRE, Java or Python. That decides what works: named groups (?<name>...), lookbehind and Unicode property escapes like \p{Script=Han} (with the u flag) are available; atomic groups (?>...), recursion (?R) and inline flags (?i) are not. When a pattern copied from another language fails, rule those out first.
When something obviously should match but does not, check these in order:
- The pattern still has its slashes: pasting
/\d+/gmakes the two/literal characters, so nothing ever matches. This box wants the bare expression without delimiters. - The dot does not match newlines: for multi-line content use
[\s\S]*?or enable s. - Anchors only see the whole string: enable m for per-line
^and$behaviour. - Character classes are narrower than expected:
\dmatches ASCII 0-9 only, so fullwidth digits do not count, and\wis ASCII letters, digits and underscore - for CJK write[\u4e00-\u9fa5]or use\p{Script=Han}with u. - Greediness swallowed the tail:
.*runs to the end of the line; switch to.*?or state the terminator explicitly.
The position column is a UTF-16 code-unit offset, not a character ordinal: if the match is preceded by emoji or rarer CJK characters (two code units each), the number is larger than a human count. Use the same coordinate system if you slice strings with it.
To keep large inputs responsive, at most 5000 matches are counted and 2000 are highlighted; the status bar says so when a cap is reached, and the real total is best confirmed with matchAll in code. Captured groups show only parenthesised content, unmatched optional groups appear empty, and named groups are listed without their names.