• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Finding the first space in a paragraph using GREP

Enthusiast ,
Jun 10, 2019 Jun 10, 2019

Copy link to clipboard

Copied

I am a beginner while using GREP in InDesign I have nearly 300 questions listed in one document. The questions begin with Q and the question number like

Q.32 Name the building.....

Q.33 Regional planning developer.........

Now I want to add more space after every space that starts before the word of the question . So

Q.32 Name the building.....

will become

Q.32   Name the building.....

What is the search string in GREP find and replace box so that The GREP should find ONLY the first space that occurs in a paragraph before an alphabet. That particular paragraph must start with the letter Q

or

The GREP can find the first space that occurs in a paragraph after Q.xxx

xxx is digits at maximum of three.

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Guide , Jun 10, 2019 Jun 10, 2019

one solution could be:

find:

^Q\.\d{1,3}\K\x{20}

replace:

replace with space which you want

Votes

Translate

Translate
Enthusiast , Jun 10, 2019 Jun 10, 2019

https://forums.adobe.com/people/vladan+saveljic  wrote

one solution could be:

find:

^Q\.\d{1,3}\K\x{20}

replace:

replace with space which you want

Wow!! Thanks a lot!

Can you provide a detailed description please that tells the breakdown portion of each part?

^Q means Q at the starting of every paragraph. What about others?

Votes

Translate

Translate
Guide ,
Jun 10, 2019 Jun 10, 2019

Copy link to clipboard

Copied

one solution could be:

find:

^Q\.\d{1,3}\K\x{20}

replace:

replace with space which you want

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 10, 2019 Jun 10, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/vladan+saveljic  wrote

one solution could be:

find:

^Q\.\d{1,3}\K\x{20}

replace:

replace with space which you want

Wow!! Thanks a lot!

Can you provide a detailed description please that tells the breakdown portion of each part?

^Q means Q at the starting of every paragraph. What about others?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 10, 2019 Jun 10, 2019

Copy link to clipboard

Copied

\. full stop

\d any digit

{1,3} min 1, max 3

\K lookbehind

\x{20} any space

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 10, 2019 Jun 10, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/vladan+saveljic  wrote

\. full stop

\d any digit

{1,3} min 1, max 3

\K lookbehind

\x{20} any space

Thanks.

Okay I just explored, \K is a new addition to InDesign intead of traditional lookbehind.

Moreover, are there two wildcards for space viz. x and s?

Another query. What about the figure of 20 inside the small bracket? How did you calculate the 20?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 10, 2019 Jun 10, 2019

Copy link to clipboard

Copied

\x{20} or \x{0020} is unicode character

\s is any white space that include also tabs and paragraph brakes

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 11, 2019 Jun 11, 2019

Copy link to clipboard

Copied

\x{20} or \x{0020} is unicode character

You may enter as many zeroes before 20 as you like, they do nothing.  I mean, \x{0000000020} will do exactly the same: will pick up all *regular* spaces (the ones you get by hitting a space bar), and will ignore all other flavors. Em, En, Hair, Thin, Punctuation, Figure, Flush spaces, you name it…

Sometimes it's for good, sometimes not. Sometimes you want to use \x{20}, \h, or \v, or something else, sometimes one-for-all \s is just ok. It depends.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 11, 2019 Jun 11, 2019

Copy link to clipboard

Copied

https://forums.adobe.com/people/vladan+saveljic  wrote

\x{20} or \x{0020} is unicode character

\s is any white space that include also tabs and paragraph brakes

Okay, I am getting little confused with x{0020}, or x{20}. The small brackets are a part of InDesign GREP lingo? I searched for the unicode equivalent here.

http://www.codetable.net/hex/20

It says &#x20.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2019 Jun 11, 2019

Copy link to clipboard

Copied

arjun2  wrote

… Okay I just explored, \K is a new addition to InDesign

FWIW: \K was introduced with InDesign CS6, I think.

Regards,
Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 11, 2019 Jun 11, 2019

Copy link to clipboard

Copied

You didn't use a numbered list ??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 11, 2019 Jun 11, 2019

Copy link to clipboard

Copied

LATEST

vinny38  wrote

You didn't use a numbered list ??

No.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines