Code & data
Test a regular expression: matches, positions and supported syntax
Find product-code patterns in sample text, check match positions, and understand the limits of KitForma’s bounded regex tester.
Find two letters followed by three digits
Suppose a plain-text note contains AB123 xx CD456. Enter [A-Z]{2}[0-9]{3} in the pattern field, g in the flags field and the note in the input field. Do not include slash delimiters around the pattern. The tester reports two matches, including each match’s start and end position.
The first class permits uppercase ASCII letters; its repetition count requires two. The second class requires three ASCII digits. Without boundaries, this searches for matching substrings: a longer identifier can contain one too. That makes this example useful for finding candidates, not automatically validating a whole identifier.
Input: AB123 xx CD456
Pattern: [A-Z]{2}[0-9]{3}
Flags: g
Matches: AB123 [0, 5), CD456 [9, 14)
The end position is excluded.Separate searching from whole-input checks
Use ^[A-Z]{2}[0-9]{3}$ with no flags when the entire input must have this shape. AB123 matches; prefix AB123 does not. Test an input that should fail as well as one that should pass. A pattern that finds the expected example can still accept more than you intended.
The g flag requests multiple matches. The i flag provides ASCII case-insensitive matching. The m flag makes edge anchors apply to lines. Use m deliberately: a valid line within a larger input is a different requirement from validating the entire input as one value.
- Start with one valid sample and one invalid sample.
- Check the exact matched text, not just the match count.
- Add flags one at a time and rerun both samples.
Know which regex features are available
KitForma’s tester supports literals, character classes, the dot, edge anchors and ?, *, + or {n,m} repetition. It does not support groups, alternation, backreferences, lookarounds, lazy quantifiers, word boundaries or Unicode flags. The MDN reference describes JavaScript regex more broadly; it is not a list of features implemented by this tool.
Patterns are limited to 300 UTF-16 code units, input to 20,000 and output to 1,000 matches. Positions use UTF-16 offsets, so a visible emoji before a match can occupy more than one position. The tool avoids backtracking through a deliberately limited engine; it cannot certify a pattern’s behavior in a database, programming language or production service.
Use a separate operation for literal replacements
The regex tester displays matches; it does not edit the input. Find and Replace performs literal replacements and keeps replacement text such as $& literal. Do not paste a regex into that tool expecting regex substitution.
If the next task is a straightforward rename, keep the original text, use a literal replacement, then compare the result with Text Diff. For structured data, choose a parser for the actual format instead of relying on a short regex to understand every possible document.
KITFORMA
Put it into practice
No account needed. Open an article, then try the matching tool.
Further reading
How to use this guide
Published by KitForma, maintained by Fatih Erkan. The linked references explain the relevant formats and definitions. Examples use sample inputs; they do not establish a speed, quality or compatibility guarantee for your files. Check the tool’s stated limits and inspect your downloaded result.