Skip to main content
Inspiring
March 9, 2022
Answered

GREP Newbie find & delete text

  • March 9, 2022
  • 1 reply
  • 377 views

I am working on 14 documents that each paragraph has a number and a space or an inline icon, number and space. I need to remove the number & space. I am then changing each paragraph to a numbered list.

 

I am using  ^\d+?\s+ which works fine for the paragraphs with ni icon.

 

 ^~a\d+?\s+ works for selecting the icon number & space, but I want just the number & space after the icon. Also ther can be anywhere from 1 to 4 icons.

 

Any ideas how this can be done? Look ahead of the icon doesn't seem to work.

 

 

Thanks

This topic has been closed for replies.
Correct answer jctremblay

You can use this for both scenario:

 

(?<!.)~a*\K\d+?\h+

 

 

1 reply

jctremblay
Community Expert
jctremblayCommunity ExpertCorrect answer
Community Expert
March 9, 2022

You can use this for both scenario:

 

(?<!.)~a*\K\d+?\h+

 

 

Inspiring
March 9, 2022

Thanks, that works great .

Just so I learn & understand, I know some of those and just discovered the K.