I have some divs which contain URLs. I simply want to remove the URLs and replace them with something else, for example 'No URLs allowed'. I have used the replace method with jQuery, but it only replaces the http
part of the link. How can I replace the whole URLs?
var text = $('#text1').text();
$('#text2').text(text.replace(/http/g, ''));
<script src="https://code.jquery.com/jquery-2.2.4.js"></script><div id="text1">This is my div with some http://example.com/ URLs in, I simply want to https://example.com remove all the URLs and replace them with 'no URLs allowed'</div><br><div id="text2"></div>