Pointing at a value instead of writing a regular expression
Extraction pointers — how the editor infers a pattern, why it tests it against twenty messages, and what RE2 refuses.
When extraction is not enough — a house identifier, two codes in the same message, a token in a format that is yours alone — the industry’s usual answer is to send you off to write a regular expression in your test suite. That is exactly the skill the tool was supposed to spare you.
Here: you point at the value in a real message, the platform writes the pattern.
The gesture
In the inbox view, open a message and select the value you care about. The editor proposes several patterns, ranked, each with its rationale. You pick one, name it, save it.
The pointer then applies to every new message in that inbox, and you read it back under its key:
message.extract.orderCode;
The five strategies
| Strategy | What it produces | When it wins |
|---|---|---|
shape | \b(\d{6})\b | The shape is unique in the message |
context | anchored on the preceding words | The recommended default — survives a layout redesign |
context-strict | anchored on four words | Several values of the same shape |
loose | \b(\d{5,7})\b | The sender sometimes strips leading zeros |
literal | the exact value | A string that never changes |
The ranking is not cosmetic: patterns that capture exactly the selection, and only once, come first.
context is recommended because it anchors on the last literal words preceding the
value. A layout changes often; “your confirmation code is” much less so.
The pattern is tested against twenty messages, not the one you are looking at
Before saving, the pattern is run against the twenty most recent messages in the inbox, and the editor shows how many yield exactly one capture.
A pattern that works on the message in front of you and fails on the ten before it is precisely the one that will break a CI run at three in the morning.
The preview uses the production engine
Testing and preview are executed by the ingestion service itself, not by the browser and not by the API. If the editor validated with JavaScript’s regular expressions while ingestion uses Go’s, you would see a green tick on a pattern that behaves differently in production — the worst kind of defect, because you were shown that everything was fine.
What RE2 refuses, and why that is good news
The engine is RE2: linear time, no backtracking. A pattern written by a customer therefore cannot stall ingestion — yours or anybody else’s.
The trade-off is real, and the editor states it rather than letting you save a pattern that will never compile:
- no lookahead
(?=…)or(?!…); - no backreferences
\1.
Almost everything a lookahead would be used for here can be rewritten by anchoring on
context, which context already does.
Advanced mode
The pattern field stays editable. What you write there is validated the same way — compiled by RE2, then run against the last twenty messages. There is no path that skips the check.