Here is my code, but is not working.
btn.addEventListener("click", function () {
var get = document.getElementById('myTxtArea').value
var res = get.split(/[ ,-]+/).join(';')
textarea.innerText = res
res.select();
document.execCommand('copy');
})