GREP: Find text assigned an [A] style
Learn / Forums / General InDesign Topics / GREP: Find text assigned an [A] style
- This topic has 5 replies, 2 voices, and was last updated 8 years, 9 months ago by David Blatner.
-
AuthorPosts
-
-
June 30, 2015 at 5:29 am #76324Tom HybertMember
Hey guys,
I’m sure this is super simple but I can’t for the life of me work it out. I have some text formatted by a copyeditor with tags like this:
[A]Count the toys
[Act]Count the toys. Write the number.
[G]Children count the toys in each box and then write down the number.
Some children may find it helpful to match each object with a counter or cube to support their counting.
[Footer]Counting to find out how many, writing the numberI want to apply paragraph styles to those tagged lines using grep. Presumeably I need to get it to look for text following [A] but before the next [ and then apply an A style to that. How do I go about that?
Thanks,
Tom -
June 30, 2015 at 6:35 am #76325David BlatnerKeymaster
One way to do that is to use the findchangebylist.jsx script. Another way is to use MultiFindChange from automatication.com
Just search for [A] and delete it and apply the A paragraph style:
https://creativepro.com/use-findchange-to-delete-in-indesign.php -
June 30, 2015 at 6:46 am #76326Tom HybertMember
Thanks David,
I need to look for all the text that comes after the [A] tag and assign it a paragraph style. There may be multiple paragraphs so it needs to look for the next square bracket tag to know where to stop assigning the style I think.
I’ll have a look at the scripts you posted.
Most appreciated, thanks.
-
June 30, 2015 at 7:58 am #76327David BlatnerKeymaster
So not all paragraphs are tagged? So it might look like:
[A]first paragraph
second paragraph
third paragraph
[B]fourth paragraphIs that correct? in that case you would search in the GREP tab for:
(?s)^\[A\](.+?)(?=\[)
and then apply the paragraph style A
That grep means “apply this to more than one paragraph, then starting at the beginning of the paragraph, search for [A] followed by any text up to, but not including, another [” -
June 30, 2015 at 8:07 am #76328Tom HybertMember
David you’re a bloomin’ genius. Thanks so much.
-
June 30, 2015 at 8:10 am #76329David BlatnerKeymaster
Glad that worked for you! Then, if you find yourself doing 5 or 10 or more of these find/change queries in a row (each for a different paragraph style), that’s when you want MultiFindChange or findchangebylist.
-
-
AuthorPosts
- You must be logged in to reply to this topic.