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

Re: Substitution problem

Expand Messages
  • Marian Csontos
    On Wed, 31 Aug 2005 10:43:50 +0200, Bouckaert, Hugo ... Hi, try ... find word boudaries. ... Regards -- Marian ________ Information from NOD32
    Message 1 of 4 , Aug 31, 2005
    • 0 Attachment
      On Wed, 31 Aug 2005 10:43:50 +0200, Bouckaert, Hugo
      <Hugo.Bouckaert@...> wrote:

      >
      > Hi
      >
      > I have a minor irritating problem with substitution I can't seem to get
      > right. I want to substitute:
      >
      > :%s/lv_postal_street/r_bio.postal_street/g
      >
      > But the problem is that I also have a string "lv_postal_street2" so that
      > for lv_postal_street2 it also substitutes "r_bio.postal_street".
      >
      > I tried
      >
      > :%s/lv_postal_street[^2]/r_bio.postal_street/g
      > i.e. "lv_postal_street", "not followed by 2" but it does not work.
      >
      > Any ideas?
      >
      > Thanks
      >
      > Hugo
      >

      Hi,

      try

      :%s/\<lv_postal_street\>/.../g

      \< and \> find word boudaries.
      :he \<
      :he \>


      Regards

      -- Marian



      ________ Information from NOD32 ________
      This message was checked by NOD32 Antivirus System for Linux Mail Server.
      http://www.nod32.com
    • Scholte, J.C.M.
      use ... Hans Scholte, ... Van: Marian Csontos [mailto:csontos@axa.sk] Verzonden: woensdag 31 augustus 2005 11:38 Aan: Bouckaert, Hugo; vim@vim.org
      Message 2 of 4 , Aug 31, 2005
      • 0 Attachment
        use
        :%s/lv_postal_street\(2\)\@!/r_bio.postal_street/g


        Hans Scholte, <DPC/>



        -----Oorspronkelijk bericht-----
        Van: Marian Csontos [mailto:csontos@...]
        Verzonden: woensdag 31 augustus 2005 11:38
        Aan: Bouckaert, Hugo; vim@...
        Onderwerp: Re: Substitution problem


        On Wed, 31 Aug 2005 10:43:50 +0200, Bouckaert, Hugo
        <Hugo.Bouckaert@...> wrote:

        >
        > Hi
        >
        > I have a minor irritating problem with substitution I can't seem to get
        > right. I want to substitute:
        >
        > :%s/lv_postal_street/r_bio.postal_street/g
        >
        > But the problem is that I also have a string "lv_postal_street2" so that
        > for lv_postal_street2 it also substitutes "r_bio.postal_street".
        >
        > I tried
        >
        > :%s/lv_postal_street[^2]/r_bio.postal_street/g
        > i.e. "lv_postal_street", "not followed by 2" but it does not work.
        >
        > Any ideas?
        >
        > Thanks
        >
        > Hugo
        >

        Hi,

        try

        :%s/\<lv_postal_street\>/.../g

        \< and \> find word boudaries.
        :he \<
        :he \>


        Regards

        -- Marian



        ________ Information from NOD32 ________
        This message was checked by NOD32 Antivirus System for Linux Mail Server.
        http://www.nod32.com
      • Keith W. Roberts
        ... You got two great answers, but I thought I d amplify. The reason your original didn t work was that [^2] specifies that there *must* be a character
        Message 3 of 4 , Aug 31, 2005
        • 0 Attachment
          > -----Original Message-----
          > From: Bouckaert, Hugo [mailto:Hugo.Bouckaert@...]
          > Sent: Wednesday, August 31, 2005 1:44 AM
          > To: vim@...
          > Subject: Substitution problem
          >
          >
          > Hi
          >
          > I have a minor irritating problem with substitution I can't
          > seem to get
          > right. I want to substitute:
          >
          > :%s/lv_postal_street/r_bio.postal_street/g
          >
          > But the problem is that I also have a string
          > "lv_postal_street2" so that
          > for lv_postal_street2 it also substitutes "r_bio.postal_street".
          >
          > I tried
          >
          > :%s/lv_postal_street[^2]/r_bio.postal_street/g
          >
          > i.e. "lv_postal_street", "not followed by 2" but it does not work.
          >
          > Any ideas?

          You got two great answers, but I thought I'd amplify. The reason your
          original didn't work was that [^2] specifies that there *must* be a
          character following the rest of the string, just not a '2'.

          -Keith
        Your message has been successfully submitted and would be delivered to recipients shortly.