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

Regex newbie question

Expand Messages
  • B.P. de Vries
    Hello, I have a rather large csv file with amounts which have a comma as decimal seperator. I want this comma changed in a decimal point. I can find the
    Message 1 of 6 , Oct 10, 2006
    • 0 Attachment
      Hello,

      I have a rather large csv file with amounts which have a comma as
      decimal seperator.
      I want this comma changed in a decimal point.

      I can find the occurences [0-9],[0-9], but don't know how to replace
      only the comma.
      Tried $1\.$3 but that doesn't do the trick.

      A little help would be fine

      Thanks in advance
      --

      Met vriendelijke groet,

      *Bauke P. de Vries
      *



      [Non-text portions of this message have been removed]
    • Don - HtmlFixIt.com
      ... I think the replace is 1. 3 but I m not the expert. I would use the GetField function to get just that field and replace it without regex as it will be
      Message 2 of 6 , Oct 10, 2006
      • 0 Attachment
        B.P. de Vries wrote:
        > Hello,
        >
        > I have a rather large csv file with amounts which have a comma as
        > decimal seperator.
        > I want this comma changed in a decimal point.
        >
        > I can find the occurences [0-9],[0-9], but don't know how to replace
        > only the comma.
        > Tried $1\.$3 but that doesn't do the trick.
        >
        > A little help would be fine
        >
        > Thanks in advance

        I think the replace is \1.\3
        but I'm not the expert.

        I would use the GetField function to get just that field and replace it
        without regex as it will be faster.
      • Axel Berger
        ... That same problem has kept me too occupied for a while some time ago. To be made useable the expression has to be bracketed. This should work:
        Message 3 of 6 , Oct 10, 2006
        • 0 Attachment
          "B.P. de Vries" wrote:
          > I can find the occurences [0-9],[0-9], but don't know how
          > to replace only the comma.
          > Tried $1\.$3 but that doesn't do the trick.

          That same problem has kept me too occupied for a while some time ago. To
          be made useable the expression has to be bracketed. This should work:

          ([0-9]),([0-9])

          Axel
        • B.P. de Vries
          ... Thank you! Works great! -- Met vriendelijke groet, *Bauke P. de Vries * [Non-text portions of this message have been removed]
          Message 4 of 6 , Oct 10, 2006
          • 0 Attachment
            Axel Berger wrote:
            > "B.P. de Vries" wrote:
            >
            >> I can find the occurences [0-9],[0-9], but don't know how
            >> to replace only the comma.
            >> Tried $1\.$3 but that doesn't do the trick.
            >>
            >
            > That same problem has kept me too occupied for a while some time ago. To
            > be made useable the expression has to be bracketed. This should work:
            >
            > ([0-9]),([0-9])
            >
            > Axel
            >
            >
            > Fookes Software: http://www.fookes.us, http://www.fookes.com
            > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >
            Thank you! Works great!

            --

            Met vriendelijke groet,

            *Bauke P. de Vries
            *



            [Non-text portions of this message have been removed]
          • Sheri
            Hi Brian, I would think you d need to use $2 instead of $3 since you have only two sets of captured parentheses. You could simplify your regular expression by
            Message 5 of 6 , Oct 10, 2006
            • 0 Attachment
              Hi Brian,

              I would think you'd need to use $2 instead of $3 since you have only
              two sets of captured parentheses.

              You could simplify your regular expression by substituting \d
              (stands for digit) for your 0-9 classes, e.g., use (\d),(\d)

              Above relates to NoteTab 5+.

              Regards,
              Sheri

              --- In ntb-clips@yahoogroups.com, "B.P. de Vries" <bauke@...> wrote:
              >
              > Axel Berger wrote:
              > > "B.P. de Vries" wrote:
              > >
              > >> I can find the occurences [0-9],[0-9], but don't know how
              > >> to replace only the comma.
              > >> Tried $1\.$3 but that doesn't do the trick.
              > >>
              > >
              > > That same problem has kept me too occupied for a while some time
              ago. To
              > > be made useable the expression has to be bracketed. This should
              work:
              > >
              > > ([0-9]),([0-9])
              > >
              > > Axel
              > >
              > >
              > > Fookes Software: http://www.fookes.us, http://www.fookes.com
              > > Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
              > >
              > > Yahoo! Groups Links
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > >
              > Thank you! Works great!
              >
              > --
              >
              > Met vriendelijke groet,
              >
              > *Bauke P. de Vries
              > *
              >
              >
              >
              > [Non-text portions of this message have been removed]
              >
            • Don Daugherty
              ... Try this ^!Replace ([0-9]),([0-9]) $1.$2 R You need capturing parentheses in the find expression for $1 and $2 to have meaning and you don t want
              Message 6 of 6 , Oct 10, 2006
              • 0 Attachment
                B.P. de Vries wrote:
                > I can find the occurences [0-9],[0-9], but don't know how to replace
                > only the comma.
                > Tried $1\.$3 but that doesn't do the trick.
                >
                Try this

                ^!Replace "([0-9]),([0-9])" >> "$1.$2" R

                You need "capturing parentheses" in the find expression for $1 and $2 to
                have meaning and you don't want the \ in the replace expression. (But
                you would need it in the find expression if you were looking for an
                actual decimal point some time.)
              Your message has been successfully submitted and would be delivered to recipients shortly.