Regex-tester
Live-treffmarkering
- "hello@privvert.com" at index 12
- "test@example.org" at index 34
Om dette verktøyet
Test JavaScript regular expressions against sample text with live highlighting and a list of every match and capture group. The right tool for building a tricky regex, debugging one that isn't working, or learning regex by experimenting.
Privvert uses the browser's own regex engine (the same one that runs your JavaScript), so the matching behavior is exactly what you'll get in production code. Includes flag toggles, replace mode, and a friendly error display.
The tester runs your pattern against the input string using the browser's native JavaScript regex engine - the same one your code will use at runtime - so results match exactly what users will experience. Capture groups, named groups, lookbehind, Unicode property escapes and all modern flags (g, i, m, s, u, y) are supported.
Funksjoner
- Live match highlighting in the sample text
- List of all matches with capture groups
- Flag toggles: g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode), y (sticky)
- Replace mode with capture-group references
- Real-time error messages for invalid patterns
- Browser-only - content never uploaded
- Free and unlimited
Slik bruker du det
- Type or paste a regex pattern.
- Toggle flags as needed.
- Paste sample text.
- Inspect highlighted matches and capture groups.
- (Optional) switch to replace mode and see the result.
Alt skjer inne i nettleseren din med JavaScript og WebAssembly. Filene dine lastes aldri opp, lagres aldri og ses aldri av oss.
Ofte stilte spørsmål
ECMAScript / JavaScript regex - the engine your browser uses to run JS. Slightly different from PCRE (used in Perl, PHP, Python) - most patterns work the same but a few advanced features differ.
Common gotchas: forgetting the g flag for multiple matches, using ^ and $ without the m flag for line anchors, using . without the s flag (which doesn't match newlines by default).
Yes - (?
Yes - enable the u flag for full Unicode mode (\p{Letter} etc.). Without it, character classes work on ASCII only.
Regex flavors differ. PCRE (PHP, Perl), Python's re, .NET, Go's RE2 and JavaScript all have subtle differences in features like lookbehind, possessive quantifiers and named groups. Test in the engine your production code uses.
No - they are nested, context-sensitive formats that regex cannot reliably parse. Use a real HTML parser (DOMParser, cheerio) or JSON.parse. Regex is for tokenizing flat text: emails, log lines, simple patterns.