Search code examples
regexvimnon-printable

How do I replace or find non-printable characters in vim regex?


I have a file with some non-printable characters that come up as ^C or ^B, I want to find and replace those characters, how do I go about doing that?


Solution

  • Say you want to replace ^C with C:

    :%s/CtrlVC/C/g

    Where CtrlVC means type V then C while holding Ctrl pressed.

    CtrlV lets you enter control characters.