Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var stroka = "http://spb.site.ru/der/der/";
- function removeWords( str ) {
- var lastWord = '';
- return str.replace( /([^s]+)(s|$)/g, function( all, w, e ){
- return lastWord.toLowerCase() == w.toLowerCase() ? '' : ( lastWord = w ) + e;
- });
- }
- console.log( removeWords( stroka ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement