Grep help

Explorer ,
Aug 24, 2022 Aug 24, 2022

Copy link to clipboard

Copied

I have a document with a lot of "Motion X" in it, and am trying to do a big find and replace.

 

I dont have a good handle on grep and have done the expression "Motion\s\d*" which does work, but it is also including text such as "Motion carried / lost". Example below.

 

danielw42205661_0-1661403830480.png

 

I just want to restrict it to finding the word "Motion", then a space and then a number after it (could be 1 to 3 digits). 

 

I did play around with using square brackets but that didn't seem to help. Any help would be greatly appreciated, thanks.

 

 

 

TOPICS
How to

Views

59

Likes

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 1 Correct answer

Community Expert , Aug 25, 2022 Aug 25, 2022

Hi @danielw42205661 ,

the * od d  means zero or more digits.

 

You could try also this:

Motion\s\d{1,}

Which means one or more digits in a row. You could restrict the maximum number of digits in a row if you add a second number after the comma. Or you could change the first number to 2 if you want to find only a minimum of two digits in a row.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate
Community Expert ,
Aug 24, 2022 Aug 24, 2022

Copy link to clipboard

Copied

Are you trying to replace the word Motion?

 

Motion\s\d+?

 

If you want to replace just the word Motion

Motion(\s\d+?)

Change to

New Word$1

 

Does it ever have Motion 1.01 (with decimals)?

 

 

Likes

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 ,
Aug 25, 2022 Aug 25, 2022

Copy link to clipboard

Copied

Hi @danielw42205661 ,

the * od d  means zero or more digits.

 

You could try also this:

Motion\s\d{1,}

Which means one or more digits in a row. You could restrict the maximum number of digits in a row if you add a second number after the comma. Or you could change the first number to 2 if you want to find only a minimum of two digits in a row.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

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 ,
Aug 25, 2022 Aug 25, 2022

Copy link to clipboard

Copied

quote
\d{1,}

By @Laubender

That is such an awesome GREP! 

Likes

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
Explorer ,
Aug 26, 2022 Aug 26, 2022

Copy link to clipboard

Copied

LATEST

Thanks! Worked a treat. 

Likes

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