Hi @King Java,
You can use below design and inline script which works for me:
Firstly, I have a mail with 2 links as below:
Design:
var ritest = /https?:\/\/\S+/g;
var ri_links = workflowContext.trigger.outputs.body.body;
var ri_out = ri_links.match(ritest);
var safelinkRegex = /originalsrc="(https?:\/\/\S+)"/g;
var test_safe_links = [];
var chomatch;
while ((chomatch = safelinkRegex.exec(ri_links)) !== null) {
test_safe_links.push(chomatch[1]);
}
var testURLs = ri_out.concat(test_safe_links);
testURLs = testURLs.filter(url => !url.includes("nam06.safelinks.protection.outlook.com"));
var ri_unq_urls = Array.from(new Set(testURLs))
.map(url => url.replace(/[".]+$/, ''));
const uniqueArray = ri_unq_urls.filter((value, index, self) => self.indexOf(value) === index)
if (ri_unq_urls.length > 1) {
return ri_unq_urls[1]; } else {
return null; }
Output:
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.