Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Help building javascript regular expression

Avatar of rae_rae
rae_raeFlag for United States of America asked on
JavaScriptRegular ExpressionsjQuery
1 Comment1 Solution309 ViewsLast Modified:
I have this code:
$('#' + 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
Avatar of rae_rae
rae_raeFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answers