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.
More Related Contents:
- Set style for only the first element using JQuery [closed]
- Random JSON where x is true
- Pure JavaScript toggle for select / deselect all checkboxes [duplicate]
- How does this JavaScript/jQuery syntax work: (function( window, undefined ) { })(window)?
- Get DOM content of cross-domain iframe [duplicate]
- How to convert a currency string to a double with Javascript?
- .keyCode vs. .which
- Avoid dropdown menu close on click inside
- How to properly use jsPDF library
- How to get the element clicked (for the whole document)?
- How to clear the contents of an iFrame from another iFrame
- Prevent form redirect OR refresh on submit?
- Displaying a number in Indian format using Javascript
- Simulate Keypress With jQuery
- Javascript reload the page with hash value
- jquery’s live() is deprecated. What do I use now?
- jQuery: get data attribute
- How do I automatically play a Youtube video (IFrame API) muted?
- jQuery Drag/Resize with CSS Transform Scale
- I want to store Javascript array as a Cookie
- Remove table row after clicking table row delete button
- jQuery ajax load() java script not executing?
- Format a JavaScript string using placeholders and an object of substitutions?
- jQuery Table to CSV export
- How to bind click event to object tag?
- How do I determine scrollHeight?
- How to start mouseover event while dragging
- How to detect if a device has mouse support?
- fadeOut() and slideUp() at the same time?
- Jquery change text between two elements