Jquery Wilcards

$("[id^=POST_][id$=_THEME]")

It will return all the elements that matches all the specified attribute filters: source

match elements with id attribute starting with POST_

[id^=POST_]

match elements with id attribute ending with _THEME.

[id$=_THEME]

 ...or classes

[class$=_THEME]

 Loop through multiple and do something

link.className = 'MY_THEME_ONE';

$("[class^=_THEME]").each(function () {
    if (link.className != this.className) $(this).remove();
});