I am aware of the jQuery regex plugin of James Padolsey: http://james.padolsey.com/javascript/regex-selector-for-jquery/
But I need something different:
The following will match requirement 1, but not 2:
$('*').filter(function() {
return this.text().match(/\d\d\d/);
});
Any idea how i can do this with a good performance?
This should get you an Array
of all matches.
var text = $('body').text().match(/\d{3}/g);
jsFiddle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With