Coodeverse

Regex Tester

Write a pattern, paste sample text, and watch matches highlight as you type. Syntax errors are reported with the position. Uses the same engine your script will.

/
/

What this tool does

It compiles your pattern with new RegExp and runs it against the sample text, wrapping every hit in a highlight. Compilation failures are caught and shown rather than thrown, so you can see the exact offset of a missing bracket instead of guessing.

Zero-length matches are handled — the engine advances one position after each so patterns like \b or (?=x) cannot spin forever.

The flags

When to use it

Catastrophic backtracking

Nested quantifiers are the usual culprit: (a+)+b against a long run of a with no b at the end tries an exponential number of ways to split the run. The browser will sit there. Anchoring with ^, using a lazy quantifier, or replacing the inner + with an atomic-ish shape usually collapses it back to linear.

The other frequent mistake is forgetting to escape. . matches any character; \. matches a literal dot. Same for (, ), [, ], {, }, +, *, ?, |, ^ and $.

Questions

Which regex dialect is this?

JavaScript, via the browser's own RegExp engine.

What does the global flag do?

Finds every match instead of stopping at the first.

Why does my pattern hang?

Almost always catastrophic backtracking from a nested quantifier. Anchor it or make it lazy.

Is my text uploaded?

No. Everything runs locally.

Related tools