[ad_1]
You could use the following regex to replace from the first - character and any characters there after.
$(".colsborder h3").each(function(){
var str = $(this).text();
var replaced = str.replace(/-.*/, '');
$(this).text(replaced)
});<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="colsborder">
<h3>Startoftext-needtoremove</h3>
</div>This method would be faster than using the substring or split methods.
1
[ad_2]
solved Remove text that starts with [closed]