4 Replies Latest reply on Aug 13, 2014 8:23 AM by crizlo

    Pricing conversion using GREP

    crizlo Level 1

      In InDesign, is it possible to change conventional US pricing ($00.00) to traditional French pricing (00,00 $) using GREP?

       

      I have hundreds of instances in a catalog where I need an easy way to may this conversion.

      $0.00 to 0,00 $

      $00.00 to 00,00 $

      $000.00 to 000,00 $

       

      Hoping for a solution.

       

      Thanks.

        • 1. Re: Pricing conversion using GREP
          Eugene Tyson Adobe Community Professional & MVP

          Find

          (\$)(\d+)\.(\d+)

           

          Change to

           

          $2,$3 $1

          • 2. Re: Pricing conversion using GREP
            crizlo Level 1

            Eugene,

             

            That works perfectly. I wish I understood how it works. But just knowing that it does will save me so much time.

             

            Thanks for your assistance!!!!

            • 3. Re: Pricing conversion using GREP
              Eugene Tyson Adobe Community Professional & MVP

              $ is a dollar sign normally - but in GREP it means end of paragraph.

               

              To get around this we escape it using a "\" so it's written as \$ - that now finds dollar signs.

               

              Putting it in parenthesis makes it a "Found item" (\$) and because it's the first on the search marked as Found 1

               

              \d is a digit and \d+ means keep finding digits until there isn't anymore - again putting it parenthesis makes it a Found string (\d+)

               

              "." means any character at all - to get a full stop or a period it's written as "\." where the "\" escapes and captures just a full stop. We don't want this as a Found string.

               

              Therefore (\$)(\d+)\.(\d+) = Find a dollar sign and remember it as Found, find any digits after this and remember it as Found. Find a full stop but not mark it as Found. And find all digits after this up until there are no more and mark them as Found.

               

               

              In the change string

               

              $ = a Found String

               

              $2,$3 $1

               

              What you wanted to do was swap the First Found string and put it at the end.

               

              $2 and $3 are the digits within the price.

               

              So I want these to go First

               

              $2$3

               

              And I want to separate them with a comma

               

              $2,$3

               

              Now I want to put the dollar sign (first found string) at the end

               

              $2,$3 $1

               

               

              Basically

               

              (\$)(\d+)\.(\d+)

              $1..$2...$3

               

              $.....10...00

              $1...$2...$3

              • 4. Re: Pricing conversion using GREP
                crizlo Level 1

                Thanks for the explanation. Well said, and easy to understand for us GREP novices.