Prevent command sanitizer from replacing partial matches

Fixes #800