Auto link/note creation within an imported annotated note

What I’m trying to do

I am a therapist and use Obsidian for importing annotations from articles and books. Most of my readings include APA-style references within the paragraph, such as:

  • (Ben-Levy, 2023)
  • (Ben-Levy & Johnson, 2014)
  • (Ben-Levy, 2023; Ben-Levy & Johnson, 2014; Terrance et al., 1992)

I like to use those references to create new notes, such as

  • ([[Ben-Levy, 2023]])

It allows me to find all of the references to that article throughout my vault before reading it. Once I read the article and annotate it, I will import it into Obsidian and use the following naming convention:

  • @Ben-Levy_2023
  • Property - alias: Ben-Levy, 2023

I would like to know if there is a tool or script that is available that will look through a new imported annotated note from Zotero and automatically add the link so that I don’t have to go through each one adding [[ ]] multiple times. I don’t need the actual note created, but just the [[ ]].

I’m a therapist and not proficient at coding or script creation. I’m curious about that process, but I’m hoping for help as this is far outside my wheelhouse. I used An Academic Workflow as my guide to setting up Zotero/Obsidian.

Below is an example of an annotation before any formatting that I might do within Obsidian:

-  Two potentially relevant factors could be coping self-efficacy (CSE) and emotion dysregulation. 
-  CSE is the perceived ability to navigate stressful environmental posttraumatic demands (Benight & Bandura, 2004).
-  Emotion dysregulation is a dynamic construct consisting of a lack of emotional awareness, understanding, and acceptance combined with an inability to manage or tolerate emotional distress (Gratz & Roemer, 2004). 
-  CSE tends to serve a protective role against negative posttraumatic sequelae including PTSD symptoms (e.g., Mahoney et al., 2019) and frequency and consequences of substance use (e.g., Dolan et al., 2008;Hayaki et al., 2011 ;Warren et al., 2007). 

Thank you!

You seem to have these cases of references in your example:

  • (an author, year) – Single author/year combo
  • (an author, year; another author, another year) – Multiple author/year combos separated by ;
  • (e.g, an author, year; another author, another year) - Multiple author/year, with e.g. in front

These examples can be matched by this rather ugly regex:

/(?:\(|e\.g\.\s*,\s*|;)([^,;(]+, \d{4})+\s*(?=[;\)])/gm

Which it should be possible to use in a regex replace operation called from a Templater function, I reckon. Sadly, I’ve not got the time tonight to actually make this template, but if someone is up for it that regex should match each of the author/year combo of the OP’s examples. See link above for test results.

I was messing around with regex earlier after posting, but realized that regex is just so awkward that I can’t figure it out. I entered additional annotation into the regex101 and it highlighted the correct parts.