mik888em,
<script>
let str = `random text 1***trash2***y6f dhy 1 month ago 14 minutes, 29 seconds 3,620 name***trash3***random text 1","random text 2***trash2***pot 5aq 3 months ago 9 minutes, 9 seconds 226,629 name***trash3***random text 2","random text 3***trash2***uan 4fp 5 months ago 26 minutes 506,950 name***trash3***random text 3"`;
let reg = /((?<=\*{3}trash2\*{3})[\s\S]+?(?=$|\s\d+\s+(minutes|minute|day|days|weeks|week|hours|hour|years|year|months|month)))|\*{3}trash3\*{3}[\s\S]+?(?=")/g;
str = str.replace(reg, "");
document.write(str)
</script>