Я, наверное, слишком усложнил, но я сделал это регулярное выражение для вас
(?<schema>[a-z]+):\/\/(?<domain>[^:/]+)(?<port>:[0-9]+)\/(?<theFirstPart>[\w]+)\/.*
Использование в пределах js:
const regex = /(?<schema>[a-z]+):\/\/(?<domain>[^:/]+)(?<port>:[0-9]+)\/(?<theFirstPart>[\w]+)\/.*/gm;
const str = `http://192.168.15.122:3000/adjusterAnalytics/individual/Xh7HTIgGw1RqnsK2TuJtiUIMahy2`;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
https://regex101.com/r/IU2Ms0/2