Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Grep positive look behind at preceding paragraph

Return to Member Forum

  • Author
    Posts
    • #54891
      avdbos
      Participant

      Hi guys,

      I am trying to set a Grep style to text in the last paragraph of a story but only if this paragraph is preceded bij <auteursvermelding> in the line above. (witch is followed by a return, so end of paragraph I guess).

      I've got: (?<=^<auteursvermelding>$/r)^.*$/r/z (forward slashes should be backward slashes but the editor won't let me type them)

      It looks like the positive look behind doesn't get past the paragraph. Is this a limitation to Grep style or did I mis something?

      I hope you can help!

      Regards,

      Anjo

    • #54892

      Hoi Anjo,

      Geen hulp… — Tried that myself a while ago, and it simply does not work. GREP styles appear to be limited to one single paragraph (you can't run over the end of a paragraph as well).

    • #54893
      avdbos
      Participant

      Beste Jongware,

      Bedankt voor de snelle reactie!

      It makes sense if you think of it: The Grep-style is part of a Paragraph-style. If you can look back outside the paragraph you might be abel to set a character-style outside of the paragraph. This would be very confusing.

      A “positive look before paragraph” match setting a style within the paragraph would help me very, very, very much.

    • #54894

      Not with this version of InDesign … (And I wouldn't hold my breath for the next either.)

      The GREP styles are “just” some sort of fancy automated search-and-replace, so theoretically you can use the regular search-and-replace to fill in the character style you need. But it's not possible to do automatically.

      Thought #1: ah, that dirty mind of mine! Change the paragraph return to a soft line break … (and don't do that if your text is justified…)

      Thought #2: I have no experience at all with line styles. No idea why that would work, but — on the other hand, I've ben surprised before by off-the-wall tips with these.

    • #54895
      Anonymous
      Inactive

      If the text is justified you can probably use right align tab and soft return

    • #54896

      Hello,

      I am not sure to understand very well the problem, but why don't you use a Find/Search applying a Change format ?

    • #54897

      I would say Find/Change !

      With this regex : ((?<=^<auteursvermelding>$/n)|(?<=^<auteursvermelding>$/r))^.*$/r*/z

      and a Change Format applying a paragraph with GREP style.

    • #54898
      avdbos
      Participant

      Thank you very much!

      The Find/Change option works fine. But…

      I am trying to do set styles automatically in articles of a magazine. (such as heading, sub-heading and writer), Because the content of the copy is different every time, I have to look for specific structure. A heading is always the first paragraph of these stories. A sub-heading can be found in these articles by searching for a paragraph containing 1 – 4 words. The writer is at the end of the story but sometimes theres no mention of the writer. So you know if there's a writer when you find the <auteursvermelding> tag.

      A find/change option will be just as effective as setting a style by hand to the paragraph because I have to check the completed layout anyway.

      Maybe I am lazy but I still think this “fancy automated search-and-replace” could be very powerful if it could search beyond the paragraph.

    • #54899

      Hello

      Perhaps the script Chain_Grep_Queries could help you to find differents structures and apply styles in once

      You can download it here : https://www.kahrel.plus.com/ind&#8230;..eries.html

Viewing 8 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads