Page actions
instrument implementation / implementation-contract
Regex Tester implementation
A source-bound implementation contract for Regex Tester; deployment and executable qualification remain separate.
Status: VERIFIED_CLEANLifecycle: implementation-contract
Binding contract
This record describes what an executable surface must bind and validate. It does not claim that a public calculator, package, or production route is deployed.
- Record owner
- Guth Instruments
- Lifecycle
- verified-clean
- Evidence ID
- t4-184
- Effect
- Computation or source lookup only
Input and validation requirements
- Division-by-zero is not applicable to this instrument, but an unguarded global zero-length pattern can cause an infinite loop if the implementation does not advance after an empty match.
- Invalid patterns or flags must produce a defined error result rather than a match list.
- UTF-16 offsets can split surrogate pairs when u is absent; the UI must label offsets as UTF-16 code units or explicitly convert them.
- Regexes with catastrophic backtracking can cause severe latency or denial of service; execution limits or cancellation are needed.
- Global matching state can persist in lastIndex when a reusable RegExp object is used, causing surprising results unless lastIndex is reset or managed explicitly.
- The native iOS note is correct: ICU NSRegularExpression is not behaviorally identical to JavaScript RegExp and must not be presented as an equivalent engine.
- The honest label should also disclose that JavaScript engine versions and supported flags can differ, and that match indices and zero-length behavior depend on the selected API contract.
Required corrections
No binding erratum is attached to this unique-name record. Implementers must still preserve the declared units, domain, and failure behavior.
Inspectable interface fixture
The sample below is evidence for interface and validation tests, not a production implementation.
{
"inputs": {
"pattern": "cat",
"flags": "gi",
"test_string": "Cat scat"
},
"expected_outputs": {
"match_list": [
{
"text": "Cat",
"start": 0,
"end": 3,
"groups": []
},
{
"text": "cat",
"start": 5,
"end": 8,
"groups": []
}
],
"capture_groups": [
[],
[]
],
"highlighted_match_spans": [
[
0,
3
],
[
5,
8
]
],
"match_count": 2
},
"working": "1. UTF-16 positions in \"Cat scat\": C=0, a=1, t=2, space=3, s=4, c=5, a=6, t=7. 2. /cat/i matches \"Cat\" at start 0, exclusive end 0+3=3. 3. It also matches the final three characters of \"scat\": start 5, exclusive end 5+3=8. 4. Global matching returns 2 matches. 5. 2 matches × 0 capture groups gives capture arrays [], []."
}Other records
Sources and evidence
These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.
VERIFIED_LEDGER.jsonevidence-tranche4/tranche4-results.json