Skip navigation
Joe Seven
Currently Being Moderated

Brochure... need help with GREP

Apr 16, 2012 5:59 PM

Tags: #indesign

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

 
Replies
  • Currently Being Moderated
    Apr 17, 2012 12:02 AM   in reply to Joe Seven

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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 1:53 AM   in reply to Joe Seven

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 6:33 AM   in reply to Joe Seven

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 6:33 AM   in reply to Prashant Bhatnagar

    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...

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 6:50 AM   in reply to Peter Spier

    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 :-)

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 9:53 AM   in reply to Prashant Bhatnagar

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 10:20 AM   in reply to Peter Spier

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 2:21 PM   in reply to Prashant Bhatnagar

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 21, 2012 9:10 AM   in reply to Joe Seven

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 13, 2012 12:44 AM   in reply to Joe Seven

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points