Give it a try. I tried to convert the jQuery regex selector to which Kobe is tied to the Sizzle selector extension. This seems to work, but I have not tested many tests.
Sizzle.selectors.filters.regex = function(elem, i, match){
var matchParams = match[3].split(',', 2);
var attr = matchParams[0];
var pattern = matchParams[1];
var regex = new RegExp(pattern.replace(/^\s+|\s+$/g,''), 'ig');
return regex.test(elem.getAttribute(attr));
};
In this case, your example will be written as:
var arrayOfLinks = Sizzle('a:regex(href,[0-9]+$)');
source
share