im grabbing the current url path directory /products/ from www.mysite.com/products/watches
using this expression /\/(.*?)\//
so im trying to find the list item that has /products/ using the expression
<ul>
<li><a href="/home.htm">home</a></li>
<li><a href="/products/watches">watches</a></li>
<li><a href="/services/watch-repair">repairs</a></li>
<li><a href="/support/refund">refund</a></li>
</ul>
this is what i have so far. here is a better example on fiddle
Your regex is fine. Your javascript needs to be more like.
The code finds each link starting with your regex and marks it as active.