Skip to main content

re_escape

Function re_escape 

pub fn re_escape(s: &str) -> String
Expand description

Byte-exact equivalent of CPython’s re.escape (as behaving on the pinned interpreter): escapes exactly the special-character set Python does — including space, #, &, -, ~ (escaping) — and passes everything else (incl. all non-ASCII) through untouched. Verify the exact set against the source-of-truth venv, not from memory.