You can use the method filterto check the content:
$('div').filter(function(){
var t = $(this).text();
return t == '.co.uk' || t == '.com' || t == '.net';
})
You may still want to filter out as many elements in the selector as possible to reduce the number of elements that the filter function should check. Even if the pseudo-class containscannot determine the exact match, it can still be used to reduce the result:
$('div:contains(".co.uk"), div:contains(".com"), div:contains(".net")`).filter(function(){
var t = $(this).text();
return t == '.co.uk' || t == '.com' || t == '.net';
})