2 Replies Latest reply on Jul 20, 2011 1:28 PM by dot•

    GREP string to replace value


      Hello, I am new here. I am currently creating a large catalogue of products.

      The lines of text under each product are as is (code of product consisting of reference and voltage, then size of product, then price) :


      963B-80 watts, 20 x 58 inches, XX,XX$ (prices were not ready at first so I inserted XX,XX$ as a price)


      I would like to insert via find/replace the correct price for all the "80 watts" items where the XX,XX now stands (at the end of the line), without changing anything else on the line of text.

      Then I would use another similar string to replace the prices of items with different voltage specified in the line of text (250 watts, etc)


      Could anyone help me with the find/replace string to use? I am very new to this. Thanks!

        • 1. Re: GREP string to replace value
          SJRiegel Adobe Community Professional & MVP

          If all of your lines are set up with the watts and inches as your example, this should work. For example, If the price for 80 watt items is 3,99$


          FIND:      (80 watts, \d+ x \d+ inches, )(XX,XX)

          CHANGE TO:    $1 3,99



          For each other wattage, just change the wattage in the find expression and the price in the change-to


          The $1 leaves the first part of the find unchanged


          I tried to set this up as a postive lookbehind, but I must have left something out--I couldn't get it to work that way.

          • 2. Re: GREP string to replace value

            This expression can also try changing the wattage.


            (?<=80 watts,)([^,]+,\s)(XX,XX)(?=\x{0024})


            changes in $1price