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 search that works only in the endnotes. Why?

Return to Member Forum

  • Author
    Posts
    • #14356431
      Tamás Nagy
      Participant

      Hi friends,

      some years ago I saved a GREP search in InDesign that finds dash-pairs with some text in between, and replaces the very first and very last space in the enclosed text with non-braking spaces. I mean things like this:

      This is a sentence with – a Hungarian style – dashed text in it.

      Here the spaces after the opening and before the closing dash should be replaced wiht their non-braking pair. I entered the following regular expression into the Find what field:

      (–)( )([ ^~U ^~F ^\. ^~= ^\R ^\( ^\) ]+)( )(–)
      (In the middle part I entered spaces between the different items so that it could be read more easily.)

      It all means that please find an n dash, followed by a space, followed by some text that doesn’t contain the listed things (for example a paragraph end or another n dash), followed by a last space and the closing n dash. For now it is not interesting what I wrote into the Replace with field.

      In earlier versions of InDesign (2020 and before) it worked finely but from 2021 it behaves very strangely: it finds what I want only in the Endnotes, but not in the main text or in the footnotes. I tried to copy the same texts into several places but the only hits were in the Endnotes.

      Can someone check if it is only my problem? Or can someone explain me what is going on here?

      Thanks, and all the best:
      Tamás

    • #14356435
      Tamás Nagy
      Participant

      Sorry, the \R was \r, of course.

    • #14356436
      Godfried Vonk
      Participant

      Maybe so:
      Find what field: –(.+?)–
      Replace field: –~s$1~s–
      But this will work only within a paragraph

    • #14356438
      Tamás Nagy
      Participant

      Hi Godfried,

      thx for your kind response, it worked fine in some cases! Your solution has a much simpler structure than mine, so I’ll use it from now! :) The problem with it is that it’s very important that there must not be paragraph ends in between, or a period that indicates the end of a sentence, for example. Your solution didn’t filter out these cases. That’s why I entered that “any text but not return, not period, not dash etc.” part in it.

      This is a sentence with – a Hungarian. style – dashed text in it.

      Here the period is not allowed between the dashes.

    • #14356439
      Tamás Nagy
      Participant

      Anyway: why does your seach work only within a paragraph? I definitely welcome this condition but I don’t understand why it stoppes at the paragraph end. :D

    • #14356441
      Tamás Nagy
      Participant

      And more importantly: why my version didn’t work in the main text, only in the endnotes? :o

    • #14356443
      Godfried Vonk
      Participant

      Too many questions…
      About the paragraph search limit: in Peter Kahrel’s must-have book it says: “Single-line mode determines the behaviour of . (the dot wildcard). When single-line mode is off, which is GREP’s default state, .* matches everything from the cursor position to the end of the paragraph, except the paragraph mark itself.”

      Maybe someone else has an answer to your last question…

    • #14356477
      Tamás Nagy
      Participant

      Fine, thank you very much for your help! :)

      Btw. I purchased that book of Peter but I haven’t met this “single line mode” thing so far because I didn’t read the book from the beginning up to the end, I only used it as a handbook: when something wasn’t clear I opened the book on that specific page and read that topic only. And unfortunately this behaviour of the . wildcard wasn’t mentioned at the explanation of this dot on page 13.

      Anyway, as you said it still doesn’t explain the difference in behaviour of the same text in the endnotes and anywhere else. So this question is still unsolved. If someone knows the solution, please tell it to me! :)

    • #14356487
      Godfried Vonk
      Participant

      I tried your expression and it didn’t work because of the ^~U in it, could that be the culprit?

    • #14356488
      Tamás Nagy
      Participant

      Well, removing that ~U (and ~F as well) worked at last.
      I have no idea why I wanted to exclude endnote and footnote markers from here, there’s nothing wrong with them between the dashes.

      Now I think all my questions are solved, thanks for your patience and huge brains!
      If you come to Budapest (Hungary) some time please sign up for a sixpack of Bitburgers at me! :)

    • #14356490
      Godfried Vonk
      Participant

      Coincidentally, I’ve visited Budapest last week, BEAUTIFUL! Next time I’ll drop by! :^)

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