I see you are using jQuery so you can do this:
$('#groups-list a').each(function(){
var $this = $(this);
var href = $this.attr('href');
href = href.replace('groups/', '');
$this.attr('href', href);
});
you can also do this:
$('#groups-list a[href*="groups"]').each(function(){ this.href = this.href.replace('/groups', ''); });
plain JavaScript:
var anchors = document.querySelectorAll( "#groups-list a[href*='group']");
for (var i = 0; i < anchors.length; i++) {
var anchor = anchors[i];
anchor.href = anchor.href.replace('/groups', '');
}