How to Test a Regular Expression
Enter a pattern such as \d+ and sample text such as order 42. With the g flag, the tester lists every non-overlapping match up to a display limit of 1,000. Without g, it returns the first match. Edits are debounced briefly before matching. Syntax errors appear beside the tool, and patterns that run too long are terminated rather than allowed to freeze the page.
Regex Flags and Match Modes
The g flag searches globally, i ignores case, m changes line-boundary anchors and s lets dot include line terminators. Unicode modes u and v change character handling and cannot be enabled together. The sticky y flag requires a match at the current search position. The d flag is accepted when supported by your browser; the interface displays each full match's start index, numbered captures and named captures.
Capture Groups and Character Classes
Parentheses create numbered groups; (?<name>...) creates a named group. A noncapturing group uses (?:...). Character classes such as [0-9] match one character from a set, while a following + repeats it. Inspect each result to distinguish the complete match from captured pieces. Positions use JavaScript UTF-16 code units, so an emoji may occupy two positions. Empty matches are marked with ∅ and the search advances to avoid an endless loop.
Common Regex Examples
Try \d+ for digit runs, ^[A-Z]{2}\d{4}$ for a simple code, or the supplied named-group email-like sample. The email sample demonstrates captures; it is not a complete validator for real email addresses. Add positive and negative test cases, empty input and boundary values. Avoid nested unbounded quantifiers such as (a+)+ when a simpler expression can express the requirement.
Regex Engine Compatibility
This regex checker uses JavaScript RegExp, not PCRE, Python re or a database-specific engine. Escape rules, lookbehind support, Unicode properties and flags may differ elsewhere. JavaScript string literals also require another layer of escaping that is not needed in this pattern field. Retest in the destination language before deploying a pattern. Sample text is limited to 100,000 characters, and pathological patterns stop after one second.
Standards and references
Frequently asked questions
How do I test a regex online?
Enter the pattern without surrounding slashes, choose flags and type sample text. Matches update after a short delay and appear with groups and start positions.
Which regex flags are supported?
The tool passes g, i, m, s, u, v, y and d to your browser's RegExp engine. Unsupported, repeated or incompatible flags produce an error.
Can I inspect capture groups?
Yes. Every result shows numbered capture groups and any named groups, alongside the full match and its start index.
Why does a regex work differently across languages?
Regex dialects differ in syntax, Unicode behavior and supported features. This tester uses JavaScript; verify the same pattern in its destination language.
Is sample text uploaded?
No. Matching happens in an isolated worker in your browser. Patterns and sample text are not uploaded.