GREP to replace long row of periods with tab

Learn / Forums / General InDesign Topics / GREP to replace long row of periods with tab

Viewing 3 reply threads
  • Author
    Posts
    • #55161
      Josh Freeman
      Member

      Just got a document where the author uses long series of periods instead of a tab with leader dots — all series are different lengths, of course. I'd love to replace these all at once with a nice simple tab character. Not being much a grep expert….can't figure out how to do this. Anyone know?

    • #55164

      A quick GREP primer: One-or-more is +. Any character is . so it's not a good idea to use this … Put a backslash before it to make it literal: . That makes the search expression

      .+

      and you should replace it with a simple tab:

      t

      Now hold on before you run off: that one-or-more means that a single period will also be replaced by a tab. I bet that's not what you had in mind, so let's make sure it only works with, say, 3 or more. This, instead, would work

      …+

      but you can go for a fancy notation as well:

      .{3,}

      No need for a plus! The {3,} part means: at least three times and an unlimited max (as there is no number given). (Some useful variants could be {3} to only find sets of 3 periods, or {3,5} to only find sets of 3, 4, and 5 periods.)

    • #55167
      Josh Freeman
      Member

      I had managed to get most of the way myself, if turns out. But it wasn't working right. I thought it was the GREP I was creating, but it seems there must have been some other weird characters in there. I ended up replacing their mess by hand. it's fine. And (as usual) I learned a lot in the process. Always a good thing.

      Thanks!

    • #100971
      William Posey
      Participant

      For anyone else that finds this – since the PERIOD is a special character in grep searches it must be escaped by placing a backslash in front of it. When posting to this comment the backslash was probably deleted:

      FIND: \.{3,}
      REPLACE: \t

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>