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

Search for text in the middle of a line

Return to Member Forum

  • Author
    Posts
    • #56306
      lowjackson
      Member

      I need to remove the dash when it appears at the end of a line (see the left text box), However I need to keep it when it appears in the middle of the line (as on the right).

      I love a bit of grep but can't find a way to reference this, any ideas?

      Download the indesign file here

      thanks
      LJ

    • #56313

      It's just one of those things — although Adobe's Help on GREP mentions 'line' several times, ID's version of GREP does not really support lines, and where Adobe sez 'line' you are supposed to mentally translate it to 'paragraph' instead.

      This is one of the things that you cannot do in the interface but can with a little scripting: if you search for en-dashes, a script can tell you which line it is on, and even on which line the next character is. My little script does just that: it searches for “en-dash space any character”, and then checks if the line for the first character (the en-dash) is the same as the 'any character'. If not, it applies a character style “Invisible”.

      The style “Invisible” is a simple style, with only the fill color set to None. But: the very first thing the script does is … setting the fill color to black, and then throwing it away. That's because in a script you cannot delete a style without “preserving formatting” (at least, I cannot find a way to do so). Throwing away the style means everything in your text boxes gets reset to showing all en-dashes; then the script checks every en-dash again, and hides the ones that need to.

      Click ->here<- to download the script; save into your own User Scripts folder, and double-click to run. If I'm correct, it does not need anything special from CS3, '4, or '5 — theoretically it ought to work with either.

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