I'm needing to convert something like this:
[[Click here|ThisIsALink]]
to:
[Click here](https://example.com/this-is-a-link)
I'm able to find the first [[Click here|ThisIsALink]] by using this regex /\[\[(.*?)\|(.*?)\]\]/g which I can replace to turn it into [Click here](https://example.com/ThisIsALink]), but how then can I take that last part and convert it to this-is-a-link? I've tried a few things but I seem to be finding all PascalCased occurrences and not just the occurrences that happen within the first found regex pattern. (I am converting .md files to .pdf, so it is a full page of content, not just these links).
Here's what I have so far
var exampleUrl = "https://example.com/";
var urlOne = /\[\[(.*?)\|(.*?)\]\]/g;
data.replace(urlOne, "[$1](" + exampleUrl + "$2)"));
This results in:
[Click here](https://example.com/ThisIsALink)