GREP to replace long row of periods with tab
- This topic has 3 replies, 3 voices, and was last updated 6 years, 3 months ago by .
- You must be logged in to reply to this topic.
Learn / Forums / General InDesign Topics / GREP to replace long row of periods with tab
Learn / Forums / General InDesign Topics / GREP to replace long row of periods with tab
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?
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.)
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!
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
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies allows us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.
You have to be logged in to save.
Not a member? Join Today - it's FREE!