Skip to main content
Participant
April 12, 2023
Question

GREP to find number in table following asterisks and make bold

  • April 12, 2023
  • 1 reply
  • 527 views

I'm trying to understand GREP and need to find all numbers that follow an astricks "*" within all tables in my document.  There may be numbers that have a space between the astricks  like "* 199" or the astricks may be right next to the number "*199".  The number can be any number of digits and some with decimals.  Thanks!

This topic has been closed for replies.

1 reply

SRS77Author
Participant
April 14, 2023

I think I solved this on my own.  It's very basic GREP but you have to start somewhere!  So if it helps anyone else here is what I came up with ...

For the instances that it is a number after an asterisks with no space between the asterisks and number I used this...

(?<=\*)\d*

 

I added a second GREP for the instances that have a space between the astericks ...

(?<=\*\s)\d*

 

I'm sure there is a way to do this with one GREP but I have not gotten that far yet!  

 

Since the aterisks is also part of the GREP language you must add a "\" before it so it does not think you are writing more grep code.  If you symbol is something other than an asterisk, you would just replace the \* with whatever it is, for example of your number was preceded with a dollar sign you would use \$.

 

Hope this helps another newbie!

 

Cheers

 

Willi Adelberger
Community Expert
Community Expert
April 14, 2023

Make a single GREP (?<=\*\s?)\d*

You can make a GREP style. Or you can find and replace, but style is better here.

SRS77Author
Participant
April 19, 2023

Thanks Willi!  I knew there was a way and now I know.  Appreciated.