You need to set the g flag to replace globally:
date.replace(new RegExp("https://stackoverflow.com/", "g"), '')
// or
date.replace(/\//g, '')
Otherwise only the first occurrence will be replaced.
You need to set the g flag to replace globally:
date.replace(new RegExp("https://stackoverflow.com/", "g"), '')
// or
date.replace(/\//g, '')
Otherwise only the first occurrence will be replaced.