так?
const links = [
'mysite.com/param/sometext-alt-text/otherparam/text?zzzz',
'mysite.com/param/foo/otherparam/qqqqqq',
'mysite.com/param/123/otherparam/jfghjfghk?...',
'mysite.com/param/foo/otherparam/gdfsghdfhkj',
'mysite.com/param1/sometext-alt-text/otherparam/text?zzzz',
'mysite.com/param2/foo/otherparam/qqqqqq',
'mysite.com/param/123/otherparam3/jfghjfghk?...',
'mysite.com/param/foo/otherparam4/gdfsghdfhkj',
];
const re = /param\/(?<param>.+)\/otherparam\/(?<otherparam>.*)/;
links.forEach(link => {
const found = link.match(re);
console.log(link, found);
});
и регулярки лучше не подбирать а составлять.