Regex Tester
Test JavaScript regular expressions in the browser. Paste a pattern and a string, toggle flags, see highlighted matches and capture groups, then copy matches or a replace result. Patterns never leave the tab.
Runs in your browser. Nothing is uploaded.
About this tool
Test JavaScript regular expressions locally. Toggle g, i, m, s, u, and y, highlight matches in the haystack, and list capture groups. Optional replace uses the same flags and String.replace rules, including $1 backreferences.
How to use: enter a pattern, pick flags, paste a test string. Scan the preview, then copy match lines from the sticky bar. Switch output to Replace when you want a rewritten string. Invalid patterns show the engine error instead of a blank pane.
Example: /\b\w+ain\b/gi against The rain in Spain stays mainly in the plain. yields rain, Spain, and plain. A zero-width match is highlighted and does not freeze the tab; results cap at 500 matches.
Patterns and test strings stay in the tab. This is the JavaScript RegExp engine, not PCRE or Python re. After load, testing works offline. Related: URL encoder if you needed to escape a pattern for a query string.
FAQ
Related Web tools
JSON Formatter
Pretty-print, minify, and validate JSON in your browser. Paste a payload, fix indentation, and spot syntax errors without sending data to a server. Works for APIs, config files, and nested objects. Output stays on your device.
JavaScript Formatter
Beautify or compact JavaScript in the browser. Re-indent minified snippets from DevTools, or collapse whitespace for a rough size check. Formatting stays on-device so proprietary scripts are never posted to a beautifier.
SQL Formatter
Beautify SQL in the browser with dialect-aware formatting for PostgreSQL, MySQL, SQLite, and T-SQL. Paste a query, pick indent, and copy readable SQL without sending statements to a formatter service.
HTML Formatter
Beautify or minify HTML markup locally. Re-indent nested tags, collapse whitespace for production snippets, and copy formatted markup without posting templates to a formatter service. Handy for emails, partials, and messy copy-paste from DevTools.
CSS Formatter
Format and minify CSS in the browser. Expand rules for readability or compress stylesheets for a quick size check. Paste a snippet, tidy selectors and declarations, and copy the result. Proprietary styles are not uploaded.
XML Formatter
Pretty-print or minify XML documents in your browser. Indent nested elements from SOAP, RSS, and config files, or collapse whitespace for a compact blob. Parsing and formatting never leave the tab.