3
下更换的JavaScript与string.replace()
"index.html".replace('\.html$', '_fr.html');
回报 “的index.html”,表示第一个参数不匹配任何东西。但是,如果我去掉“$”
"index.html".replace('\.html', '_fr.html');
则第一个参数比赛和“index_fr.html”返回。
回到第一个例子,有人可以解释为什么“.html $”似乎不匹配“index.html”?