jQuery doesn't support regular expressions as selectors by default. There are some filters that could do that.
What you can do instead is use the jQuery filter()
method.
$('div').filter(function() {
return this.id.match(/^drop_\d+_\d+_1$/);
}).html("match");
This will basically check all the div
s in your document and use the filter() method to see if it should match or not.
I imagine this will not be the fastest way of doing, you could try to restrict the search as much as possible (e.g. $('div', container_of_divs)
), but by the looks of what you're trying to parse, it seems result is more important than speed.
As a note, your regular expression is wrong too.
drop_*_*_1
translates to something like:
drop
followed by
_
zero or more times,
_
zero or more times,
_1
Which would match something like drop_1
or drop__1
or drop___
..._1
.
Links: