Sedang mencari care untuk menghapus URL dari sebuah string dengan JavaScript? Mari lihat kode snippet di bawah ini.
const url = "Visit this page https://www.kodekativ.co/example-url/ as a url";
const result = url.replace(/(?:https?|ftp):\/\/[\n\S]+/g, '');
console.log("Removed url result: ", result);
Hasilnya:
Visit this page as a url