regex - What does the this javascript regular expression do?: "var match = self.location.href.replace(/\/$/i, '');" -


i saw expression in codebases library part of following sequence:

var url = sel.anchornode.parentnode.href; var match = self.location.href.replace(/\/$/i, ''); var replaced = url.replace(match,''); 

it suggest regular expression might strip of trailing path reutrn base url created fiddle test theory , doesn't seem check out.

http://jsfiddle.net/funkyeah/weqzz/

it strips trailing slash. single slash /


Comments

Popular posts from this blog

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

ruby on rails - Authlogic - how to make a registration and don't log in the new account? -