Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列から重複した「スラッシュ」を置き換えるにはどうすればよいですか?
例えば、
str = '/estate//info//'; alert(fragment.replace(/\/\/+/, "/"));
結果、
/estate/info//
しかし、私は、
/estate/info/
あなたも試すことができます
var val = "\\val1\\val2\\val3"; val = val.substr(0, val.lastIndexOf("\\")); alert(val);
フィドル