I want to match these tags:
<div>03-24-2010</div>
<div>04-23-2011</div>
With jquery:
("div:contains([0-9]{2}-[0-9]{2}-[0-9]{4})")
开发者_运维百科
What do I need to do to the regular expression here to make it work (using phpquery - php implementation of jquery)?
Try this:
var divs = $("div").filter(function(){
return /[0-9]{2}-[0-9]{2}-[0-9]{4}/.test($(this).text());
});
jQuery doesn't support regex selectors out of the box. You need to use a plugin in or something like http://james.padolsey.com/javascript/regex-selector-for-jquery/ (a filter)
精彩评论