I’m sure there is.
As always, you will need to provide sample input, to make testing possible.
( showing works better than telling )
In the meanwhile, you could experiment with the following version of the code in the Execute JS action:
Expand disclosure triangle to view JS source
kmvar.local_Clip.split("message://")
.slice(1)
.map(x => {
const
match = x.split(/[\s\\)]/ug)
.filter(Boolean)[0];
return `message://${match}`;
})
.join("\n");