2009-07-02 8 views

Répondre

3

Je pense que cela devrait le faire:

urlLinks = $(this).attr("href").replace(/(\/(news|blog)\/)/, "$1article/"); 

Testée comme ceci:

>>> 'http://www.example.org/news/test.html'.replace(/(\/(news|blog)\/)/, "$1article/"); 
"http://www.example.org/news/article/test.html" 
>>> 'http://www.example.org/blog/test.html'.replace(/(\/(news|blog)\/)/, "$1article/"); 
"http://www.example.org/blog/article/test.html" 
+0

Grand - merci! – Rick

Questions connexes