Learn, write, and debug regular expressions — interactively, in your browser.
Regular expressions are powerful but notoriously hard to learn. Regex Companion is an interactive tool that lets you write a regex, paste your test text, and immediately see what matches — no guessing, no trial-and-error in the dark.
Whether you're a developer who keeps forgetting whether + or * is greedy, or a student taking their first steps into pattern matching, Regex Companion explains what your regex does as you type and highlights matches in real time.
Free. Offline. No sign-up. Available in English and Dutch.
Regex Companion is a browser-based regular expression learning and testing tool. It uses the native JavaScript RegExp API, so patterns behave exactly as they do in JavaScript environments. No data is sent anywhere — everything runs locally in your browser.
The interface is available in English and Nederlands (Dutch). Use the language toggle at the top of the page to switch.
Enter your regular expression in the pattern field. The tool validates your pattern in real time and shows an error if the syntax is invalid.
Common regex flags you can apply:
g — global: find all matches, not just the first.i — case-insensitive: A matches a.m — multiline: ^ and $ match at line boundaries.Type or paste the text you want to match against in the input area. Matches are highlighted immediately.
The tool shows all matches found, including capture groups. Use this to verify your pattern does exactly what you intend before using it in code.
Regex Companion is designed as a teaching tool. As you work, the app explains what each part of your regex does — making it useful not just for testing but for building your understanding of regular expression syntax.
| Pattern | Meaning |
|---|---|
. | Any character except newline |
* | Zero or more of the preceding |
+ | One or more of the preceding |
? | Zero or one (optional) |
^ | Start of string (or line with m flag) |
$ | End of string (or line with m flag) |
[abc] | Character class: a, b, or c |
[^abc] | Any character except a, b, or c |
(abc) | Capture group |
(?:abc) | Non-capturing group |
\d | Any digit (0–9) |
\w | Any word character (letters, digits, _) |
\s | Any whitespace character |
\b | Word boundary |
Regex Companion uses no external libraries and sends no data anywhere. Your patterns and test text remain in your browser only. Previous sessions may be saved in localStorage and IndexedDB for convenience.