Copy link to clipboard
Copied
Hi team,
I wanted a grep in Indesign which can search the white spaces before a letter (alphabet or digit) and has a specific Paragragh style and then replace the white Nonbreaking Space (Fixed Width).
The spaces before the letter can be one or many. This is used for the indentaion of the codes.
For Example:
Please help me.
Regards
Arvind
Copy link to clipboard
Copied
if the spaces you want to replace are always after soft return (as in your screenshots) one way to find them could be this grep
\n\K\x20+
Copy link to clipboard
Copied
Thanks for the reply.
But unfortuntately sometime I have hard enters also. I am look for a grep which could find the space before a letter or a digit of a paragraph style.
I have searched with the Grep that you have provided me:
Find: \K\x20+
Replace:  ~s
but when I replace with Non-Breaking space all the spaces are replaced with one. I want all the spaces to be replaced with Non-breaking spaces.
Please help me.
Regards
Arvind
Copy link to clipboard
Copied
are the spaces you want to find and replace, always at the beginning of paragraph?
in that case try this grep:
^\x20+
Copy link to clipboard
Copied
awesome. This is working.
But can you please guide me what will be the replace Grep.
Or something else.
OR
Thanks for your reply.
Copy link to clipboard
Copied
^ = beginning of paragraf
\x20 = space
+ = one or more times
Copy link to clipboard
Copied
Hi Vladan,
Thanks for the reply but I am not able to replace with the Non-Breaking spaces.
I have tried many options but I am not able to do it.
Please help me.
I want the replace to be like this:
Before:
After:
I have done this manually
Copy link to clipboard
Copied
ok. is the number of spaces always the same?
if not, how many variables are there?
Copy link to clipboard
Copied
the Number of spaces are not always the same, it depends upon the Indentation of Codes.
It starts from 1 space and goes upto 20-30 spaces.
Copy link to clipboard
Copied
You could make this in 2 steps:
step 1)
find ANY space and replace with non breaking spaces
Find
\x20
Replace with
~s
step 2)
Find
([[:graph:]])(~s)([[:graph:]])
Replace with
$1"digit one space with spacebar"$3
Copy link to clipboard
Copied
I am sorry. The given suggestion is not working.
The Grep given by you is working perfectly to my requirement:
^\x20+
But I am not able to replace the white spaces with Non Breaking space
Copy link to clipboard
Copied
try my modified suggestion before your last post
Copy link to clipboard
Copied
Marvelous. You are rockstar.
Its working for me.
To help me understand.
Its finding all the whitespace in the document and replacing it with a Non Breaking space.
and then its finding the Non Breaking space between the letter and its replacing it with white space.
Copy link to clipboard
Copied
in the step 2 the grep finds non breaking space between any graphical character: letter, digit, punctuation character, etc... (not only letter)
Copy link to clipboard
Copied
Thanks for help and support.
If possible can you help me with one more thing.
I want to enhance my skills in making Greps in Indesign.
Can you provide be any reference or any tutorials.
Regards
Arvind
Copy link to clipboard
Copied
maybe you could do this in ONLY ONE step.
Try it
Find
(?<![[:graph:]])\x20
Replace with
~s
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now