1

I've a file with has a invalid character, I want to learn how to search for those kind of characters. Please check image, is what appear after ..get Ale

I've checked with an heximal editor and the value is

f480 8080 0d 

vim with weird character

I tried with /[^[:alnum:][:punct:][:space:]] with it also returns spaces, dashes etc.

Arnold Roa
  • 7,335
  • 5
  • 50
  • 69

1 Answers1

2

I am not quite sure what you mean by "invalid character," but if what you want is to search for non-printable characters, type:

/[^[:print:]]

If you want to search for ASCII hex 0d, type: /[\u000d] or /^Vx0d where "^V" means [Ctrl]-V (type V while holding the "Control" key pressed).

Check this link for more info: How do I replace or find non-printable characters in vim regex?

Community
  • 1
  • 1
Luis Guzman
  • 996
  • 5
  • 8
  • 2
    I though this was going to work but not, this highlight spaces and ctrl characters but not the `?` question mark that appear in the image. this works: `/[^\u0000-\u007F]` – Arnold Roa Jan 28 '16 at 03:43