Convert a matched string to a url

Hello all,

I would like to link to Jira tickets in my notes, these take the form of XX-123 and I have a regex that matches the appropriate form for my project.

I’d like to create a command to replace unlinked instances of XX-123 in a given line to links [XX-123](https://<project>
One at a time would be MVP, multiple instances at once across the whole page would be awesome and avoiding doing it for existing links would be pretty mandatory.

I’ve found posts on replace() and could make that work but it would probably be a bit messy, I was looking for something like prepend() and append().

I was wondering if anyone had any regex incantation or advice before I spend too much time on my own?

Edit: formatted link example

How are you using the ticket references? Just mentioning them in notes or maintaining a note per ticket? I’ve leveraged templates and SB page links to achieve something similar to what you are asking. I have a template I made for individual tickets, that template creates a page JIRA Tickets/XYZ-123, parses out the ticket number and:

  • creates a page alias that is just the ticket number, that way I can just use a page reference in my notes or whatever.
  • creates a link on the page to the ticket in Jira
  • Adds a link to the project board
  • Adds a status and other attributes to query as needed

I guess IMHO this is more beneficial to just linking directly to jira throughout my notes because now SB tracks any page link references and I can also add my own attributes, notes, tasks and whatnot to the tickets note page and it’s all encapsulated in the ticket note…Just some thoughts I thought I might share :slight_smile:


That’s a great idea, thanks, I tend to try to keep all my note about a jira ticket in the jira ticket but your approach does bring a lot of benefits, I’m still open to suggestions for direct links but will definitely try out your approach, thanks again!