Skip to main content
Inspiring
June 6, 2025
Answered

Bibliography - GREP expression

  • June 6, 2025
  • 2 replies
  • 287 views

Hi. (This may be a duplicate post, but it was lumped in to another post where it will get lost, so here we go again...  Please, Adobe, leave it as a separate query - it really is!!)
I need to be able to make just the first number within the parentheses bold, but not any others. In this sample, I have the solution:

(1) Surname Initial et al. Journal 2000;10:2XX–2XX; (2) Surname Initial et al. Journal 2000;10:2XX–2XX;
(3) Surname Initial et al. Journal 2000;10:2XX–2XX; (4) Surname Initial et al. Journal 2000;10:2XX–2XX;
(5) Surname Initial et al. Journal 2000;10:2XX–2XX; (6) Surname Initial et al. Journal 2000;10:2XX–2XX;
(7) Surname Initial et al. Journal 2000;10:2XX–2XX.

 

(?<=\()\d+.*?(?=\)) works well, but there are times when there is another number buried within each reference that can be in brackets, like this:

(1) Surname Initial et al. Journal 2000;10(23):2XX–2XX; (2) Surname Initial et al. Journal 2000;10(23):2XX–2XX;

What do I need to add to my GREP to only choose the first parenthethical number? I thought a second GREP would work, but, alas, no:

(?<=; )\d+

Any suggestions? They are all separated by a semicolon/space or semicolon/soft return, (which I guess may require yet another GREP! <sigh>) if that helps These are set scientific styles and unfortunately cannot be altered to make my life easier...

Correct answer Catharine26941291c64a

Thanks, but the nested style route just doesn't cut it where there are as many variables as these bibliographies have - the references can go well beyond a single digit and there can be other parenthetical numbers within the reference. 
I now have a working GREP (thanks to people much smarter than me!) should anyone else need it:

(?<=^\()\d+(?=\))   and  (?<=;\s\()\d+(?=\))

(Needs 2 styles applied so it won’t catch any extra parenthetical numbers)

2 replies

Mike Witherell
Community Expert
Community Expert
June 9, 2025

Just continue the Nested Styles beyond Jean Marc's suggestion:

add some more nested styles:

[None] through (

[Bold] through 1 Digits

Mike Witherell
Catharine26941291c64aAuthorCorrect answer
Inspiring
June 9, 2025

Thanks, but the nested style route just doesn't cut it where there are as many variables as these bibliographies have - the references can go well beyond a single digit and there can be other parenthetical numbers within the reference. 
I now have a working GREP (thanks to people much smarter than me!) should anyone else need it:

(?<=^\()\d+(?=\))   and  (?<=;\s\()\d+(?=\))

(Needs 2 styles applied so it won’t catch any extra parenthetical numbers)

jmlevy
Community Expert
Community Expert
June 6, 2025

I need to be able to make just the first number within the parentheses bold, 

Just to be sure: is there a hard return at the end of each line?

If yes, it means that each line is a single paragraph, so a simple nested style will work.

Inspiring
June 9, 2025

No, there isn't a hard return at each line (apologies if my copy/paste added those instead of soft returns), and the nested style doesn't capture the (2), (4) or (6) in this sample, so it does need to be a GREP