Regular Expressions in a jQuery selector
Wo开发者_运维知识库uld it be possible to select using a regular expression in jQuery? Something like
$('input[name=^[a-z]+_[1-9].*]')
There's nothing built in, but you could use the filter() method to achieve the same goal:
$('input').filter(function () { return /^[a-z]+_[1-9].*/.test(this.name); })
You can find a regex selector here (by James Padolsey), called like this in your case:
$('input:regex(name,^[a-z]+_[1-9].*)');
精彩评论