Skip to content
PrimeForgeTools
Theme: system

Developmentversion v1.0.0

Regex Tester

JavaScript semantics, and only JavaScript semantics. The match loop is String.prototype.matchAll, the preview is String.prototype.replace, and neither is re-implemented — so what you see here is what the engine in your own code will do.

Every run happens in this tab, in a Web Worker that is stopped after 500 ms. That is the reason this is the one tool on the site with no curl — the explanation is at the bottom of the page, along with the two commands that do the same job better.

JavaScript
Flags
Unicode
0 / 262,144
Highlighted
Matches—

Enter a pattern to begin.

 

$& $1 $<name> $` $' $$ — the engine's own tokens
Previewevery match

Flags

g
globalMatch every occurrence rather than only the first, and replace all of them.

Privacy

There is no server path at all. Not “we do not log it” — there is no route, no endpoint and no request body for this tool.

The Web Worker is not a network call: it is a second thread in this tab, same origin, reached by postMessage. Nothing is written to local storage, the URL or your history, so a pattern cannot be shared by link and refreshing the page discards everything.

Why there is no curl for this one

Every other tool here answers the same URL from a terminal. This one deliberately does not.

A regular expression is a program, and some of them run for a very long time. /^(a+)+$/ against 28 as and a b takes about 1.2 seconds; each two extra characters roughly quadruples that, so 40 characters is over an hour. JavaScript gives you no way to time out or abort a regex once it has started — the only way to stop one is to destroy the thing running it. This site is a single process, so one request with a pattern like that would take every other tool down with it.

In your tab it costs only your tab, and we bound even that: your pattern runs in a Web Worker that is stopped after 500 ms.

The same engine is one line away in your terminal, and it has your whole file:

node -e 'const re=new RegExp("(\\w+)@([\\w.]+)","g");const s=require("fs").readFileSync(0,"utf8");for(const m of s.matchAll(re))console.log(m.index,m[0])' < input.txt
node -e 'const s=require("fs").readFileSync(0,"utf8");process.stdout.write(s.replace(new RegExp("(\\w+)@([\\w.]+)","g"),"$2/$1"))' < input.txt

Both lines carry the pattern currently in the box, so they are your regex rather than a placeholder. The first adds g if you have not — matchAll requires it.