var url = new RegExp('^(https?://)?([da-z.-]+).([a-z.]{2,6})([/w .-]*)*/?$');
var title = $(".something").text().replace(url, '');
console.log(title)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="something">
Blah blah blah https://example.com/ ha ha ha.
</div>
Output I'm getting:
Blah blah blah https://example.com/ ha ha ha.
Output I want:
Blah blah blah ha ha ha.
Is the format of my expression itself wrong or the very way in which I'm trying to use regex within jQuery or something else?
I'm unable to remove URLs from the string.
.somethingelement? What do you expect the result to be? What are you actually seeing?[da-z.-]" 👈 why is "d" here? It's already included ina-z^) and end ($) anchors. Also,/wshould be\\w