13 Replies Latest reply: May 13, 2012 12:44 AM by printisnotdead RSS

    Brochure... need help with GREP

    Joe Seven Community Member

      Howdy folks.

       

      I am working on a brochure in InDesign (CS4). It is a jewellery brochure with prices for wholesale (W) and suggested retail price (SRP).

       

      Unfortunately they have been entered backwards, across the entire document, so all the wholesale prices are displaying suggested retail price, and vice-versa.

       

      Is there a way to use GREP to crawl through the document and flip the prices?? I've attached a screen shot of the price line. The bold is a character style.

       

      Thanks for any tips!

       

      Screen Shot 2012-04-16 at 8.49.34 PM.png

        • 1. Re: Brochure... need help with GREP
          P Spier CommunityMVP

          Try (\d+(\.\d\d)*)( \(SRP\) \$)(\d+(\.\d\d)*) and replace with $4$3$1

          • 2. Re: Brochure... need help with GREP
            Joe Seven Community Member

            Hi Peter,

             

            I look forward to trying this out this evening, will report back then.

             

            Cheers!

             

            Joe

            • 3. Re: Brochure... need help with GREP
              Joe Seven Community Member

              Unfortunately this did not work. InDesign said it could not find any matches.

              Thanks for trying though!

              • 4. Re: Brochure... need help with GREP
                P Spier CommunityMVP

                It worked here, so there's a good chance there's something different about what you have typed in the price line and what I entered, and I think I see it. I left out the colon after  the SRP. Sorry about that.

                 

                Try it this way: (\d+(\.\d\d)*)( \(SRP\): \$)(\d+(\.\d\d)*)

                 

                If that still doesn't work, it's probably the spaces (there is a plain space before and after \(SRP):) and you could use (\d+(\.\d\d)*)(\s\(SRP\):\s\$)(\d+(\.\d\d)*) which will pick up any sort of white space in case there's a fixed width space or a tab.

                • 5. Re: Brochure... need help with GREP
                  Prashant Bhatnagar Community Member

                  Hi, You can use the following GREP. Hope it solves your replacements. I am new to GREP but its seems fun taking up the troubles and fixing in a snap.

                  (\(\w\): \$\w+) (\(\w{3}\): \$\w+\.\d+)

                   

                  Basically this looks for any single character in ( ) exceding : and white space and the next with three characters in () exceeding :

                   

                  Replace with $2 $1 and I guess you are done

                  • 6. Re: Brochure... need help with GREP
                    P Spier CommunityMVP

                    That's an interesting approach, but it may be too specific. It presumes there are no decimal places in your first price (a reasonable assumption based on the example, but not really safe). I'm also not clear on how you are separating the the two prices form the text between so you can swap them...

                    • 7. Re: Brochure... need help with GREP
                      Prashant Bhatnagar Community Member

                      Thanks Peter, I agree it may be too specific and should include some buffer for decimal places.

                       

                      (\(\w\): \$\w+\.*\d+) (\(\w{3}\): \$\w+\.*\d+) - Updated

                       

                      I have divided it on these two entities, anything between these are specifically looking for text like the example. Hope you can improvise on this also, would appreciate for your time. As already mentioned, IM new to this :-)

                      • 8. Re: Brochure... need help with GREP
                        P Spier CommunityMVP

                        I think you misunderstand wht the OP needs to do. It's not a case of swapping the positions of the wholesale and retail groups, it's that the prices listed are swapped -- the whole sale number needs to be where the retail number is, and vice versa, so you need to define the string between the numbers as a separate sub-entity.

                        • 9. Re: Brochure... need help with GREP
                          Prashant Bhatnagar Community Member

                          My Apologies for the misunderstanding,

                           

                          I guess the following expression can do the needful, what do you say

                           

                          Find: (\(\w\):) (\$\w+\.*\d+) (\(\w{3}\):) (\$\w+\.*\d+)

                           

                          Replace: $1 $4 $3 $2

                          • 10. Re: Brochure... need help with GREP
                            P Spier CommunityMVP

                            I'd have to test, but I think it will work.  There are many ways to find the same text, obviously. In my expression I don't bother with anything that comes before the first digit inthe first price since that's all going to stay the same anyway, and I've made the decimal protion of the number a unit that may appear once, or not at all, just because that makes it less likely to a match anything other than a price, though that probably is not much of a risk in this case, particularly since I called out the specific intervening text. Yours will match any three-letter word in parentheses in that position.

                            • 11. Re: Brochure... need help with GREP
                              Joe Seven Community Member

                              Thank you very much Peter, this did the trick. The only minor issue was that the character styling got a bit messed, ie the ")" in "(SRP)" went from bold to regular, and some of the price numerals recieved the bold style. However that was really easy to fix with Find/Change formatting.

                               

                              Thanks again!

                              • 12. Re: Brochure... need help with GREP
                                P Spier CommunityMVP

                                How is the bold applied? GREP Find/Change can certainly screw up local formatting quite easily.

                                 

                                I suspect you should be using a nested style as part of the paragraph style applied to prices. Not seeing the whole thing I don't know what else might be in a paragraph, but if it's just the price line, create a Bold character style (should do nothing but make whatever type is there bold), then apply Bold though 1 : then [none] up to 1 ( and Bold again through 1 :. Since the bold is now part of the paragraph style, it will work no matter how you shuffle the prices , being triggered only by the positions of the colons and open parentheses.

                                • 13. Re: Brochure... need help with GREP
                                  printisnotdead Community Member

                                  I'm happy that you were able to solve the first issue. Your problem with making the font bold is now a minor one. Well, Peter is actually right; you should use the nested style. It's good that we have Peter around to help issues such as this.