Zerowidth CleanerAll measured guides

CLAUDE WATERMARK REMOVER · PRACTICAL TEST

Why does the same global regex alternate between true and false?

Our /a/g object advances lastIndex on success and resets it after failure. Cleaning shifts the second match position but does not remove the regex state; repeated tests need an explicit state policy.

Tested October 12, 2026 · v24.19.0 · 4 measured runs

Open the Claude text cleaner · Full measured data

Code-point comparison for Marked repeated letter

Measured inputs and outputs

These are locally constructed test strings, not evidence that Claude inserts these characters. We executed the saved homepage script snapshot with a minimal DOM harness and compared exact strings. The invisible-checkbox state and dash mode appear in each row. The observations below test this page's specific question. Destination observations run independently on the exact input and cleaned strings in the recorded Node runtime. We make no detector-score or statistical-watermark removal claim.

Before and after observations; full code points and strings are in the JSON download.
Fixture and modeInput string and code pointsOutput and cleaner statusObserved before / after
Marked repeated letter
direct string / keep / invisible true
"a​a"
U+0061 U+200B U+0061
"aa"
Removed 1 invisible character
{"calls":[{"matched":true,"lastIndex":1},{"matched":true,"lastIndex":3},{"matched":false,"lastIndex":0},{"matched":true,"lastIndex":1}]}
{"calls":[{"matched":true,"lastIndex":1},{"matched":true,"lastIndex":2},{"matched":false,"lastIndex":0},{"matched":true,"lastIndex":1}]}
Plain repeated letter
direct string / keep / invisible true
"aa"
U+0061 U+0061
"aa"
No selected invisible characters found
{"calls":[{"matched":true,"lastIndex":1},{"matched":true,"lastIndex":2},{"matched":false,"lastIndex":0},{"matched":true,"lastIndex":1}]}
{"calls":[{"matched":true,"lastIndex":1},{"matched":true,"lastIndex":2},{"matched":false,"lastIndex":0},{"matched":true,"lastIndex":1}]}
One match
direct string / keep / invisible true
"a"
U+0061
"a"
No selected invisible characters found
{"calls":[{"matched":true,"lastIndex":1},{"matched":false,"lastIndex":0},{"matched":true,"lastIndex":1},{"matched":false,"lastIndex":0}]}
{"calls":[{"matched":true,"lastIndex":1},{"matched":false,"lastIndex":0},{"matched":true,"lastIndex":1},{"matched":false,"lastIndex":0}]}
No matches
direct string / keep / invisible true
"bb"
U+0062 U+0062
"bb"
No selected invisible characters found
{"calls":[{"matched":false,"lastIndex":0},{"matched":false,"lastIndex":0},{"matched":false,"lastIndex":0},{"matched":false,"lastIndex":0}]}
{"calls":[{"matched":false,"lastIndex":0},{"matched":false,"lastIndex":0},{"matched":false,"lastIndex":0},{"matched":false,"lastIndex":0}]}

Four calls reveal the cursor instead of a changing input

For each exact string the observer creates one global /a/g object and calls test four times without editing the string between calls. The marked repeated-letter fixture succeeds at end positions one and three, then fails and resets to zero, then succeeds again. Deletion moves the second end position to two but preserves that true, true, false, true sequence. The single-letter reference alternates true and false. The no-match reference always fails with zero recorded. We save the boolean and cursor after every call, so a failure cannot be mistaken for a cleaner changing the same input in the middle of an experiment.

State belongs to the destination regex object

The homepage callback produces the exact output string once. All four tests occur afterward inside the observer, using the same regex object for that one stage. A new object is created for the other stage and for each fixture, avoiding accidental shared state across rows. Our previous regex articles address authored pattern semantics and escaping literal search text; this one holds the pattern fixed and measures persistent cursor state. No editor search widget, asynchronous call sequence, sticky flag or custom exec implementation runs here. The marker affects a match position, while the global flag determines the repeated-call behavior. These are separate sources of observable change.

Specify whether a test continues a search or starts anew

Keep the actual flags and the lifecycle of the regex object with a bug report. If each validation should begin at the start, deliberately use a suitable fresh object or reset state according to the application’s contract. If the goal is to continue finding matches, preserving the cursor may be intended. Deleting more text cannot settle that design decision. Our controls demonstrate repeated successes, alternation and stable failure in four small strings. They do not benchmark regex performance or provide a general validation library. After cleanup, review offsets and state together before attributing an unexpected false result to invisible characters.

Reproduce this test

Save reproduce.cjs and tested-app.js in the same folder. Run the command below with Node.js. The harness prints its runtime, script SHA-256 and every measured row. Compare those rows with the original record. Using a newer script or runtime creates a new experiment; retain the version information with your rerun.

node reproduce.cjs

Reference and next check

ECMAScript string operations provides the relevant primary definition. The table and fixture analysis are original measurements. For broader inspection, use our Unicode inspector. Read the scope distinction before interpreting cleanup as a watermark result.