Skip to main content
Inspiring
September 21, 2018
Question

Indesign grep

  • September 21, 2018
  • 2 replies
  • 397 views

Hi all,

I need to find a beginning of degit ignoring beginning of white spaces(may or may not contains).

My Grep:

^((?<=\t)*\d+)

Output will be like,

1

2

3

My grep is selected except 2. what is wrong on my regex?

Please give any helps!!

thanks,

John.

This topic has been closed for replies.

2 replies

Peter Kahrel
Community Expert
Community Expert
September 21, 2018

So you want to delete paragraph-initial space when it's followed by a digit, correct? You shouldn't put the spaces you want to delete in a lookbehind. Instead, look for paragraph-initial spaces followed by a digit:

^\s+(?=\d)

Don't use * when you don't need to: \t* matches 'zero tabs', and why would you want to replace zero tabs with nothing? Waste of time and effort.Use + whenever you can.

Jongware
Community Expert
Community Expert
September 21, 2018

I'm with Vinny on this: OP's question is not clear at all.

"I need to find", sure, but for what reason? Was "finding the dgits" a task on itself, and so now OP can report back to his client "yeah I found them"? Or should something be done with the space, the digits, the paragraph (or the document, eck., eck.)?

Peter Kahrel
Community Expert
Community Expert
September 21, 2018

Yes, the question wasn't as clear as it could be, but the OP showed the desired result, which shows that numbered paragraph should have an en space after the number and should not have white space at the start.

vinny38
Legend
September 21, 2018

I'm not sure I understand your request correctly, but I'll try to answer anyway...

Lookbehinds do not accept "repeat operators" such as *, + or ?

Instead, you can use \K

^\t*\K\d+