Replace Part Of A Url With Javascript
I've found lots of articles around matching the URL and then replacing a certain part of just that particular URL... BUT! The website I need to change has around 25,000 URLs with t
Solution 1:
You can use the replace
:
url = url.replace('/p/', '/product/');
If you have string, then you can use regex
:
myHtml.replace(/mysite\.com\/(p)\/.*/gi, 'product');
Post a Comment for "Replace Part Of A Url With Javascript"