Find and Replace GREP, Keep Some Wildcards
Learn / Forums / General InDesign Topics / Find and Replace GREP, Keep Some Wildcards
Tagged: any lowercase letter, find and replace, GREP, keep wildcard
- This topic has 5 replies, 4 voices, and was last updated 8 years, 2 months ago by Carey Martin.
-
AuthorPosts
-
-
April 8, 2015 at 7:11 am #74448Melinda MartinMember
When a client sends me a PDF (because they can’t find their original document), I convert that PDF to text and then import that over into InDesign. When the PDF is converted to text, random “hard returns” will show up. (Of course, maybe the client put them in there originally instead of just allowing the text to flow naturally.) But anyway, I have “hard returns” in the middle of a sentence, and this occurs in several sentences throught the often very-long documents.
Sample:
I’m a little teapot short(hard return)
and stout.So I do a GREP search for “any lowercase letter+standard carriage return+any lowercase letter”. And this helps me find all the instances, which is great.
However, is there a formula I could use to get it to KEEP the “any lowercase letter”, replace the “standard carriage return” with a “space”, and then KEEP the second “any lowercase letter”?
Or am I going about this the completely wrong way?
-
April 8, 2015 at 8:51 am #74452Aaron TroiaParticipant
Hey Melinda,
No you’re not going about it the wrong way, actually that’s a good use of GREP, try this
Find:
([a-z])\n([a-z])
Replace:$1 $2
You can always add more characters in the first capture group such as a closing parenthesis like you have in your sample to catch more characters before the hard return.
-
April 9, 2015 at 10:37 am #74522Melinda MartinMember
Thank you.
Okay, I know there are no stupid questions, so I’m not going to feel bad about asking this next question, lol.
I tried that before posting and it just replaces the found text with the actual text of $1 $2. (I did use the “Found” character set to insert the $1 and $2. I also tried $1 and $3, because my thought is those are strings, right? so the first lowercase letter is $1, the hard return is $2, and the second lowercase letter is $3. In my thought process.)
So I am apparently doing something wrong. Do I need to enclose it somehow?
Sample:
I’m a little teapot shor$1$2nd stout.
-
April 9, 2015 at 10:43 am #74523David BlatnerKeymaster
That’s odd. You are in the GREP tab of the Find/Change dialog box? (Not the normal Text tab.)
-
April 9, 2015 at 10:44 am #74524Melinda MartinMember
I figured it out. I had to enclose each section of text in parenthesis.
So my find is:
(/l)(~b)(/l)
and my change to is
$1 $3
-
February 10, 2016 at 8:28 pm #81826Carey MartinMember
This is exactly what I want (change wildcard digitmo to wildcard digitm. But I am a GREP virgin. I found the grep tab on the find/change box, entered what I needed in the fine what, but how do I enter the new text into the change to bit? I’m going to need this a lot as I am working through dozens of tables making this change.
-
-
AuthorPosts
- You must be logged in to reply to this topic.