How to use it
- Write the pattern
Without the surrounding slashes. Pick flags such as g (all matches) and i (ignore case).
- Paste test text
Matches are highlighted and listed with their groups and positions.
- Try a replacement
Use $1, $
and $& to build the output, then copy the code snippet.
Which regex flavour this is
This tester uses the regular-expression engine built into your browser, so results are exactly what JavaScript and TypeScript (RegExp, String.match, replace) will do, in browsers and Node.js. Most syntax is shared with PCRE, Python and Java, but some is not: JavaScript has no possessive quantifiers or atomic groups, lookbehind is supported in all current engines, and named groups are written (?<name>…).
Flags
gglobal: find every match, not just the first.iignore case;mmultiline:^and$match at each line.sdotAll:.also matches line breaks.uUnicode: treats emoji as one character and enables\p{…}classes such as\p{Script=Arabic}.ysticky: match only atlastIndex;dadds match indices.
Catastrophic backtracking
Patterns with nested quantifiers, such as (a+)+$ or (\w|\d)*x, can take exponential time on text that almost matches. In production this is a denial-of-service bug (ReDoS). Here your pattern runs in a separate worker thread: if it takes longer than two seconds we stop it and tell you, instead of the tab freezing. Fix it by removing the nesting, making alternatives mutually exclusive, or anchoring the pattern.
Matching Arabic text
\w and \b only understand ASCII letters in JavaScript, so they do not work for Arabic words. Use the u flag with [\p{L}\p{M}]+ for words in any script, or \p{Script=Arabic}+ for Arabic only. Testing data you extracted? Format it first with the JSON formatter.