/ /
No matches
No matches
Regex Tester
Regular expressions are a compact language for matching and extracting text. This tester lets you try a pattern against sample input, toggle common flags, and spot mistakes such as over-greedy quantifiers or missing escapes before you ship them into code or log filters.
How to use
- Paste or type a sample string that should match (and edge cases that should not).
- Enter your pattern and enable flags like `i` (case-insensitive), `m` (multiline), or `s` (dot-all) depending on your engine.
- Inspect highlighted matches and adjust the pattern; copy the final regex into your language’s API or config when behavior looks correct.
FAQ
- Why does my pattern match too much?
- Quantifiers like `*` and `+` are greedy by default—they take as much as possible while still allowing the rest of the pattern to succeed. Use non-greedy `*?`/`+?`, tighter character classes, or anchors (`^`, `$`, `\b`) to narrow matches.
- Do JavaScript and PCRE behave the same?
- No. Engines differ in supported features (lookbehind, recursion, Unicode properties). Test in the same dialect your runtime uses, or stick to a portable subset.
- How do I safely test user-supplied regex in production?
- Avoid unbounded backtracking on hostile input; set timeouts where your platform allows, limit input size, and prefer purpose-built parsers for structured formats like email or URLs.