$(document).on('click', '.testa', function() {
const reg = RegExp(`^[${$(this).text()}]`, 'i');
$('.red a').hide().filter((i, n) => reg.test($(n).text())).show();
$(this).addClass('active').siblings().removeClass('active');
});
Find more questions by tags jQuery