rae_rae
asked on
Help building javascript regular expression
I have this code:
I tested my expression on a javascript regex testing website and it worked fine, but as soon as I use it in my script it doesn't find anything
$('#' + divs[i]).filter(function()
{
// Look for video divs
var regex = '/\S+video/';
if($(this).text().match(regex))
{
alert(id);
}
});
The selector is getting the id of a div. If I alert($(this).text());, I get a string like my-video. I want to build a regular expression that matches any string containing the word video. I tested my expression on a javascript regex testing website and it worked fine, but as soon as I use it in my script it doesn't find anything
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.