3 Replies Latest reply on Jul 22, 2016 6:06 AM by Obi-wan Kenobi

    GREP Find/Change + Paragraph Styles

    Antonio Bertossi


      I'm editing a long document and have benefitted from community assistance already, but being new to GREP Style, Find/Change I need to ask for further help.


      Below a screenshot of the scenario (original). The two blocks of text you see anticipated by the icons have have different paragraphs styles. Icons are placed as custom glyphs.


      Now, the last line featuring C2, 9, 14,... is the target of this post. Those are London buses and I created a paragraph with another icon. The copy I'm working with unfortunately is as you see. Buses come after ";".


      The aimed result is to place a \r after the semicolon and assign the new paragraph style. The element to work with is (probably) the last ";" before the bus listing. All entries feature it in the same way, hence a global GREP Find/Change should be working fine.


      My attempts:

      From a previous discussion I used (?<=\;)[^;]+$ to match everything from the end up to the last semicolon, but then I found problematic preserving the matched characters and placing \r (using (?<=\;). starts at the beginning and stops at every semicolon+space)


      So question one: how to stop at the first semicolon from the end and replace the space with \r to  create a new paragraph?


      Then, there's question two :-)

      From my previous attempts I noticed that when replacing semicolon + space with \r, and changing the paragraph style all at once (from Rail to Bus) caused the Rail paragraph style to change as well (makes sense) to Bus style. So I tried to tell the Rail paragraph style that 'Style for following paragraph is Bus style' (and not change the paragraph style in Find/Change), but somehow that didn't work either.


      So second question is: considering to split the Find/Change in two steps, how can I then change into / apply to the newly created paragraph the correct Bus style?


      I thank you in advance for your precious help. So far the community has been great!







      Screen Shot 2016-07-12 at 22.32.23.png


      Aimed result

      Screen Shot 2016-07-12 at 22.54.51.png