I'm surprised no one has mentioned creating your own filter selector (by extending jQuery's Selector functionality). Here I've created a wildcard selectors I called "likeClass" and "likeId" that accepts any wildcard string and will find all elements that are a match (similar to Regex matching).
Code:
$.expr[':'].likeClass = function(match){
return $('[class*=" '+ match +'"]');
};
$.expr[':'].likeId = function(match){
return $('[id*=" '+ match +'"]');
};
Example Usage:
Now let's say you had multiple div elements with similar names like .content-1, .content-2, .content-n... etc and you want to select them. Now it's cake!
$('div:likeClass(content-)'); // Returns all elements that have a similar Classname: content-*
or
$('div:likeClass(content-)'); // Returns all elements that have a similar ID: content-*
Oh yeah, one more thing... you can chain it too. :)
$('li:likeId(slider-content-)').hide().addClass('sliderBlock').first().fadeIn('fast');
Enjoy!