Build positive and negative examples together when testing a regular expression. The Regex Tester uses the browser’s JavaScript engine. Python, PCRE and spreadsheet engines can behave differently.
First test: separate pattern and flags
Enter \d+ in Pattern, g in Flags and A12 B34 in the test text. Expect two matches: 12 and 34. Do not paste the JavaScript literal /\d+/g into the pattern field; the delimiters and flags have separate roles.
| Pattern | Flags | Test text | Expected matches |
|---|---|---|---|
\d+ |
Empty | A12 B34 |
Only 12 |
\d+ |
g |
A12 B34 |
12, 34 |
\d+ |
g |
123 123 |
Only ASCII 123 |
\. |
g |
a.b |
The literal dot |
. |
gu |
😀A |
😀, A |
JavaScript \d means [0-9]; \w does not cover all Japanese letters. Adding u does not expand \d to include fullwidth digits.
Choose syntax for the task
| Task | Pattern | Caveat |
|---|---|---|
| One or more digits | \d+ |
Does not match an empty string |
| Zero or more repetitions | a* |
Can produce empty matches |
| Exactly three digits | [0-9]{3} |
Can match part of a longer number |
| Either alternative | cat|dog |
Group alternatives when necessary |
| Whole postal-code format | ^[0-9]{3}-[0-9]{4}$ |
Japanese format example without m |
| Literal punctuation | \. or \+ |
Escape its special meaning |
The postal pattern accepts 123-4567 and rejects X123-4567Y; it does not verify that the code exists. A date-shaped pattern can match 2026-99-99, so calendar validity needs another check.
Compare flags
| Flag | Behavior | Example |
|---|---|---|
i |
Case-insensitive matching | hello also matches HELLO |
m |
^ and $ also match line boundaries | ^cat$ can match a cat line in multiline text |
s |
Dot also matches line breaks | a.b can span a newline |
u |
Unicode-aware mode | Dot treats a supplementary character as one code point |
y |
Sticky matching at the current position | At initial position zero, \d+ does not match A12 |
Supported UI flags are g i m s u y. Duplicates or unsupported flags produce an error. This interface does not expose d or v, even in browsers supporting them.
Empty matches and display limits
Anchors and lookarounds can match without consuming text. For example, (?=A) with g on AAB yields two empty matches. Inspect the count, since no nonempty characters may be highlighted. The tool counts and highlights matches; the chip list displays only the first 100. It does not provide a capture-group table or replacement execution.
Evaluation runs in the same browser as you type. Nested repetitions can take a long time; there is no enforced execution timeout. Start with a small excerpt instead of using unbounded untested input for a performance test.
Separate extraction from validation
- Start with a short positive example.
- Add fullwidth digits, extra prefixes, empty values and line breaks as counterexamples.
- Decide whether you need a substring or a whole-input format check.
- Repeat the tests in the actual destination language or library.
A simple email pattern cannot establish mailbox ownership or deliverability. Use a parser for HTML. The implementation does not upload test text; processing occurs in the browser. Prefer a relevant excerpt over pasting an entire sensitive log.
Frequently asked questions
What happens with an empty flags field?
The first match is displayed. Add g when you want all matches.
Does a match prove the input is valid?
It may only be a substring match. Check boundaries, meaning and application rules separately.
Return to the same workflow
Open the Regex Tester, reproduce the small example and inspect the result before processing your own data. Favorite the tool near its name to reopen it through My Tools in the same browser. Favorites store the tool choice, not your inputs or files; clearing site data removes them.
Scope and evidence
On October 25, 2026 we compared these steps and examples with the published implementation. Primary references support the standard or API; the output tables and limits describe Tools Hub. This is not a speed or capacity benchmark, a guarantee for every environment or professional certification.