1

Long time lurker, first time poster! Your tips are really valuable and have taught me what I know till now about GREP, thank you!

I have a tricky text to style and I am having some issues, and need your help.

Example text: 2012 Some product name name, State $50 This is a very impressive young pinot, with tremendous freshness and vitality. Red cherry and spice aromas, fragrant and lifted with hints of coconut and cherry-liqueur. Elegant, medium-weight, fruit-driven and bright, with pinpoint ripeness. Succulent and utterly delicious. It should be long-lived. >1-10 (rating)

96

The text above repeats 50 times with different text, so essentially it's a list of 50 wines.

The resultant text should look like this:

96 # Some product name name, State $50 This is a very impressive young pinot, with tremendous freshness and vitality. Red cherry and spice aromas, fragrant and lifted with hints of coconut and cherry-liqueur.

Elegant, medium-weight, fruit-driven and bright, with pinpoint ripeness. Succulent and utterly delicious. It should be long-lived. >1-10

2012

Explanation: 2012 needs to move from the start to the end and the number 96 should go to the start. I think this is possible with GREP search but not with GREP style. I can style the two paragraphs with NESTED styles based on the period. Using NEXT styles I can repeat it 50 times for each listing.

However, I am having trouble switching the year and the listing number. I want to make it easier for a designer, so that she can use it with minimal number of clicks.

Could you please suggest something easier than using (\d{4})(.*)(\r|\n)(\d\d\r\Z) and replacing with $3$2$1 etc

  • Are you asking about using GREP in graphic design software? If so, please mention the software name. If not, this likely needs to be posted on StackOverflow, not Graphic Design. – DA01 May 15 '14 at 0:29
  • Ah ha! made some assumptions. Sorry, I it's about InDesign. Can I move the question? – addepp May 15 '14 at 0:44
  • If it's about InDesign, it might belong here. I've added the tag for you. – DA01 May 15 '14 at 2:51
2

GREP Search and Replace is definitely the simple way to go.

You can set up the expression for the designer once, and InDesign will always remember it and keep it available in the search/replace history. He or she only has to use the dropdown to access the expression. You should also save the search and replace expressions in a text file inside the project folder, in case you need it in the future with some new install of InDesign or on a different system.

One "Change All" and it's done.

If you can predict that there will always be two sentences in the first paragraph, you could even incorporate the paragraph split into the grep expression, which opens up another shortcut:

Rather than style the split paragraphs using nested styles (it's not a best practice to use character styles to style whole paragraphs), use a circular set of "Style" and "Next Style":

Style 1 -- Next Style: Style 2

Style 2 -- Next Style: Style 3

Style 3 -- Next Style: Style 1

Once the grep search/replace has run, your designer simply selects all the text, then right-clicks on Style 1 in the Paragraph Styles panel and chooses Apply Style 1 then Next Style. InDesign formats all the paragraphs based on the sequence of styles that begins with Style 1. This can save many hours of work with repetitively-formatted content in projects like catalogs, directories, price lists and the like.

  • Thanks for the Reply Alan. This is what I have done: 1. Grep search and replace to replace the listing number and the year. 2. Apply one paragraph styles followed by a next style. 3. Include 3 Nested styles in the first paragraph style. 4. I have been working to add the Grep search and replace into the scripts under FindchangeByList.jsx, however the script just wont run. So much for automation. :) – addepp May 16 '14 at 1:23
  • FindChangeByList is built around vanilla search, not grep, so you're on an uphill battle there. But it would not be hard to add that extra paragraph break to your grep expression, and once it's in the Search history, it doesn't need any great expertise to use. – Alan Gilbertson May 16 '14 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.