What this tool does
Pulling a verification code out of an email looks like a one line regular expression until you meet real mail. This tester lets you paste email text, pick or write a pattern, and see every match with its position and captured groups. Underneath, it runs your pattern against a small set of lines that should match and lines that should be ignored, so you can see right away whether your pattern is too loose or too strict.
It uses the JavaScript regular expression engine in your browser, so what works here works in a Node.js test or a browser script. Other engines differ in details such as lookbehind support, so check your own language before copying a pattern.
The presets
The presets are starting points that show the trade offs. Any six digit number is the simplest and the loosest: it finds the code, and also order numbers and dates. A code that follows words such as verification code or security code is more precise, but it misses messages that use different wording. A grouped pattern handles codes displayed as two groups of three digits. The alphanumeric pattern covers codes like 7KX2P9, and requires both a letter and a digit so that ordinary six letter words do not match. The link preset finds URLs that contain words such as verify, confirm or token.
Pick one, then edit it. Changing a single quantifier and watching the sanity checks change is the fastest way to learn what each part of the pattern does.
Why the sanity checks matter
The first group of checks contains examples where a code is present. The second contains look alikes: an order number, an invoice total, a phone number, a year and a postal code. A good extractor matches the first group and ignores the second. When a pattern marks the second group as false positives, it will eventually pick up the wrong number in production and send a wrong code to a user or a test.
The checks are examples, not a benchmark. Passing all of them does not make a pattern correct, and failing one does not make it useless for your sender. Add your own real messages to the text box to cover the formats your product actually sends.
Why this keeps breaking in practice
Senders change templates, add marketing footers with long numbers, switch from plain text to HTML, wrap links in tracking redirects, or localise the wording of the message. Each change can quietly break a pattern that passed yesterday. The longer discussion in the article on why OTP regexes keep breaking explains the maintenance cost and the alternatives. A development approach that avoids it altogether is to receive the message in a test inbox and have the extraction done by an API that already handles the common formats, which is what the zephbox developer API offers.
Tips for writing safer patterns
Anchor on wording near the code, not on the digits alone. Use negative lookarounds so a six digit match cannot be part of a longer number. Decide the allowed length range deliberately, since four to eight digits covers most codes. Make wording case insensitive. Capture only the code with a group so you do not have to trim. Test against both the plain text and the HTML version of a message, because the same code can appear twice, and the HTML often contains extra numbers in styling and tracking links.
Privacy
Everything runs in your browser. The text you paste and the patterns you write are not uploaded or stored. Avoid pasting real, live codes for accounts you care about, since a code in a screenshot or a shared tab is still a code.
Frequently asked questions
Which regex flavour does this use?
JavaScript, as built into your browser. Lookbehind works in current browsers. Check your own language for differences before reusing a pattern elsewhere.
Why does my pattern match an order number?
It is anchored only on digits. Anchor it on wording near the code, and use lookarounds so it cannot match part of a longer number.
Can I test magic links as well as codes?
Yes. Use the link preset or write your own pattern. Be aware that tracking redirects can hide words like verify from the visible URL.
Do I need a regex at all for testing sign up flows?
Not necessarily. A test inbox with an extraction API returns the code directly, which removes the maintenance of patterns for each sender.