Regex Tester – Test Regular Expressions Online
Test regular expressions online with live match highlighting. Free regex tester with flags, examples, replace mode, and instant results for developers.
Regex Tester
Test or replace with a pattern. Set flags and run. Invalid patterns show a clear error.
g = global, i = ignore case, m = multiline (^/$ per line)
Results
Matches with index and groups. Enable g for all occurrences.
Enter a pattern and test string, then click Run.
What is regex?
Regular expressions (regex) are patterns used to match character combinations in strings. They are widely used for validation, search, and replace in code editors, linters, and APIs. JavaScript uses the same regex syntax as many other languages via RegExp.
MDN: Regular expressions is a solid reference for syntax and flags.
Common regex examples
- \d+ – one or more digits
- \S+@\S+\.\S+ – simple email-like pattern
- https?://[^\s]+ – URLs starting with http or https
- \d{3}[-.]?\d{3}[-.]?\d{4} – common phone layout (US-style)
- \s+ – runs of whitespace
Use the example buttons in the playground to load these patterns with sample text.
How to test regex
- Type or paste your pattern (no leading/trailing slashes required).
- Toggle flags: g for all matches, i for case-insensitive, m for multiline.
- Paste the string you want to test against.
- Click Run to see matches, indexes, and a highlighted preview when matches exist.
FAQ
Why do I get an invalid regex error?
Unclosed brackets, invalid escapes, or unsupported constructs will throw. The playground shows the engine error message so you can fix the pattern.
Why only one match without g?
Without the global flag, exec stops after the first match. Turn on g to list every match in the text.
What does the m flag do?
Multiline mode makes ^ and $ match line starts and ends instead of only the whole string.
Related developer tools
Explore more CopilotHub utilities for your development workflow.
- JSON to TypeScript Generator – Convert JSON into TypeScript interfaces.
- Power Fx Playground – Test Power Apps formulas instantly.
- All developer tools