Regex Tester
Test a regular expression against text and inspect matches instantly.
Input is processed in your browser and is not uploaded.
Output
Use this regex tester to validate patterns before placing them in code, data cleanup workflows, redirects, or search filters. It supports JavaScript regular expression flags. Lightweight, mobile-friendly, and built for quick repeat use.
Test patterns against real sample text before shipping them
Regular expressions are compact, powerful, and easy to misread. This tester gives you a quick place to try a JavaScript regex against sample text, inspect matches, and adjust flags before using the pattern in validation, cleanup, routing, or search logic.
Validation patterns
Try email fragments, ID formats, slugs, and form rules with positive and negative examples before adding them to code.
Data cleanup
Check extraction patterns for logs, CSV fragments, copied reports, and search results before running a replacement elsewhere.
Flag behavior
See how global, case-insensitive, multiline, unicode, and dotAll flags change the match set.
Build safer regexes
- 1Start with two or three real strings that should match and two that should not.
- 2Add anchors only when you mean to validate the entire value.
- 3Turn flags on deliberately and note which behavior changed.
- 4Move the final pattern into code with tests for the examples you used here.
Pattern check
Pattern: ^[a-z0-9-]+$
Text: textbun-toolsMatch: textbun-toolsAnchors make the pattern validate the full slug instead of finding a partial match.
Regex traps
- A pattern that works on one sample can still fail on unicode, newlines, or empty strings.
- Greedy quantifiers may capture more text than intended.
- Complex validation is often clearer when regex is paired with normal code checks.
FAQ
Which regex engine does this use?+
It uses the JavaScript regular expression engine available in your browser.
Can I use flags?+
Yes. Add flags such as g, i, m, s, u, or y in the flags field.
Why are there no matches?+
The pattern may not match the sample text, or the flags may change how matching works.