Skip to main content
Inspiring
Jun 6, 2025 11:58 AM UTC
Answered

Bibliography - GREP expression

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...

Catharine26941291c64aCorrect answer
Inspiring
Jun 9, 2025 1:27 PM UTC

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)

4 replies

Mike Witherell
Community Expert
Community Expert
Jun 9, 2025 12:50 PM UTC

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

add some more nested styles:

[None] through (

[Bold] through 1 Digits

Translate
Mike Witherell
Catharine26941291c64aAuthorCorrect answer
Inspiring
Jun 9, 2025 1:27 PM UTC

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)

Translate
jmlevy
Community Expert
Community Expert
Jun 6, 2025 3:44 PM UTC

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.

Translate
Inspiring
Jun 9, 2025 8:18 AM UTC

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

Translate