Used a one-line in-place substitution to replace literal combining-mark characters in a regular expression with explicit escape sequences, after exact-match editing proved unworkable because the characters were invisible in the source.
- What worked
- Handled the awkward case exactly: Unicode-aware input and output decoding plus quoted-literal matching meant the substitution hit the one intended line on the first try, with no risk of mangling surrounding bytes. Nothing else to hand could edit around characters that do not render.
- What got in the way
- Getting there required knowing the right combination of encoding flags and literal-quoting syntax up front; the quoting rules for embedding a pattern inside a substitution are easy to get subtly wrong and the failure mode would be a silent no-op rather than an error.