Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

GREP expression - reference list

Explorer ,
Jun 06, 2025 Jun 06, 2025

Hi. (This may be a duplicate post, but I couldn't find my first attempt, so here we go again...)
More GREP ineptitude from me. I'm afraid. 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 GREPwould 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...

TOPICS
How to , Print , Type
152
Translate
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 , Jun 06, 2025 Jun 06, 2025

This is pretty similar to yesterday's question, and again I can only make it work here using two expressions:

(?<=^\()\d+(?=\)) for the first one at the start of a your list and (?<=; \()\d+(?=\)) to find the rest. This presumes your lines are separated by hard returns. If you have lines that are ending in a semicolon followed by a soft return, using (?<=;\s\()\d+(?=\)) will get the ones after the soft retuns (and hard returns as well) along with the ones mid-line.

Your trick with the parenthese

...
Translate
Adobe Employee ,
Jun 06, 2025 Jun 06, 2025

Hi, I'll merge this post with the conversation you started yesterday. If you wish to look at the posts you've done, you can click on the Profile Icon on the top right, and select View Community Profile. 


Thanks,
Nikunj

Translate
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 ,
Jun 06, 2025 Jun 06, 2025

thank you, but this is actually a related but different query. The original post was to do with endnotes. This question is about bibliography, which is completely different. Please can  you take it back to a separate question? otherwise I'll not get an answer

 

Translate
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
Adobe Employee ,
Jun 06, 2025 Jun 06, 2025

Done, I've made it a dedicated post again. Sorry about the confusion! 

For what you're looking for, I found this (?<=^|\;\s?)\(\d+\)

Can you check if that helps? 


Thanks,
Nikunj

Translate
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 ,
Jun 06, 2025 Jun 06, 2025

It's not catching the first number - not the first time, or after a soft return. It does, however, ignore other instances of parenthetical numbers, so yay!
I also needed to split it into 2 GREPs (at the pipe) - it wouldn't work as a single expression

Translate
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 ,
Jun 06, 2025 Jun 06, 2025

This also made the parentheses around the starting number bold, which is not the style. Oh well. back to the drawing board 🙂

 

Translate
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 ,
Jun 06, 2025 Jun 06, 2025
LATEST

This is pretty similar to yesterday's question, and again I can only make it work here using two expressions:

(?<=^\()\d+(?=\)) for the first one at the start of a your list and (?<=; \()\d+(?=\)) to find the rest. This presumes your lines are separated by hard returns. If you have lines that are ending in a semicolon followed by a soft return, using (?<=;\s\()\d+(?=\)) will get the ones after the soft retuns (and hard returns as well) along with the ones mid-line.

Your trick with the parentheses around the ^ did not work for me to combine the two...

Translate
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