Rafael Soares wrote:
OK, I got it, the only problem is that the value comes from a variable. Is there any way to use a variable as a regex?
Yes. Something like this should work:
$('something').filter(function() {
return (new RegExp(value, "i")).test($(this).attr('attribute'));
});
But you probably want to do some manipulation of "value" to ensure that
it contains no special characters if it's coming from an untrusted
source such as user input.
-- Scott

