Introduction
RegExr is a web-based tool for creating, testing, and learning regular expressions. It provides real-time match highlighting, a comprehensive regex reference sidebar, and a community library of user-contributed patterns. Whether you are debugging a complex pattern or learning regex fundamentals, RegExr gives you instant visual feedback as you type.
What RegExr Does
- Highlights matches in real time as you edit the expression or test string
- Displays detailed match information including groups, indices, and captured values
- Provides a built-in reference panel documenting every regex token and flag
- Offers a replace mode showing substitution results alongside matches
- Hosts a community library of reusable patterns searchable by keyword
Architecture Overview
RegExr is a client-side JavaScript application that executes regex operations directly in the browser using the native RegExp engine. The editor parses the expression to tokenize it for syntax highlighting and error detection. Match results are computed on each keystroke and rendered as overlays on the test text. The community library and saved expressions use a lightweight backend API. The reference documentation is embedded in the app as structured data.
Self-Hosting & Configuration
- Clone the repository and run
npm install && npm startfor local development - Build for production with
npm run buildto generate static assets - Deploy the static build to any web server or CDN with no backend required for core functionality
- The community library features require the companion server; disable them for a fully offline deployment
- Customize the default expression, test text, and flags via URL parameters
Key Features
- Real-time match highlighting with zero perceptible delay on each keystroke
- Inline token explanations that describe what each part of the expression does
- Side-by-side replace mode for testing substitution patterns
- Regex flavor support covering JavaScript with notes on PCRE and other engine differences
- Shareable URLs encoding the expression, flags, and test text for collaboration
Comparison with Similar Tools
- regex101 — supports multiple regex flavors (PCRE, Python, Go) with a debugger; RegExr focuses on JavaScript with a cleaner learning-oriented interface
- Rubular — Ruby-specific regex tester; RegExr targets JavaScript developers and has a richer reference panel
- Debuggex — visualizes regex as railroad diagrams; RegExr emphasizes match highlighting and a built-in token reference
- grep/sed — command-line tools for pattern matching; RegExr is a visual companion for building and verifying patterns before embedding them in code
FAQ
Q: Which regex engine does RegExr use? A: It uses the browser's native JavaScript RegExp engine. Behavior matches what you get in Node.js and browser JavaScript.
Q: Can I use RegExr offline? A: Yes. Self-host the static build and use it without an internet connection. The community library will not be available offline.
Q: Does it support lookbehind assertions? A: Yes, if your browser supports them. Modern Chrome, Firefox, and Safari support lookbehind in their RegExp implementations.
Q: Can I save and share my expressions? A: On the hosted version, click Save to generate a shareable URL. Self-hosted instances can enable the same feature with the companion server.