Loading ...
Sorry, an error occurred while loading the content.

Re: removing control characters

Expand Messages
  • Benji Fisher
    ... I find the same problem, even after adding and to my file. Maybe you and I do not understand what is meant by control characters, or maybe it
    Message 1 of 3 , Aug 4, 2000
    • 0 Attachment
      Robert Link wrote:
      >
      > -----BEGIN PGP SIGNED MESSAGE-----
      > Hash: SHA1
      >
      > I want to take an old MSWord file, open it in vimppc, and zap all
      > control characters, leaving me alpha-num-punctuation; here's what I
      > thought should work:
      >
      > :%s/[[:cntrl:]]//g
      >
      > This nets me a warning, "Pattern not found: [[:cntrl:]]"
      >
      > All help appreciated, backchannel is just fine. Thanks!!
      > - --
      > Robert Link

      I find the same problem, even after adding <C-X> and <C-C> to my
      file. Maybe you and I do not understand what is meant by control
      characters, or maybe it is a bug. I get the same behavior under linux.

      Why not try

      :s/[^[:punct:][:alnum:][:space:]]//g

      or

      :s/[^[:print:]]//g

      Maybe the first: I do not know whether control characters count as
      "printable," but <Tab> does not. BTW, <Tab> is really <C-I>; you might
      want to keep those.

      HTH --Benji Fisher
    • Bram Moolenaar
      ... This is a bug. The NUL character is accidentally included in the range, and it truncates the regexp. I ll make a patch for it against 5.7. --
      Message 2 of 3 , Aug 4, 2000
      • 0 Attachment
        Robert Link wrote:

        > I want to take an old MSWord file, open it in vimppc, and zap all
        > control characters, leaving me alpha-num-punctuation; here's what I
        > thought should work:
        >
        > :%s/[[:cntrl:]]//g
        >
        > This nets me a warning, "Pattern not found: [[:cntrl:]]"

        This is a bug. The NUL character is accidentally included in the range, and
        it truncates the regexp. I'll make a patch for it against 5.7.

        --
        hundred-and-one symptoms of being an internet addict:
        116. You are living with your boyfriend who networks your respective
        computers so you can sit in separate rooms and email each other

        /// Bram Moolenaar Bram@... http://www.moolenaar.net \\\
        \\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///
      Your message has been successfully submitted and would be delivered to recipients shortly.