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

前端 未结 6 1679
青春惊慌失措
青春惊慌失措 2021-01-30 07:09

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?

6条回答
  •  醉话见心
    2021-01-30 07:13

    None of the answers here using Vim's control characters worked for me. I had to enter a unicode range.

    :%s/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]//g
    

    That unicode range was found on this other post: https://stackoverflow.com/a/8171868/231914

提交回复
热议问题