Last active
November 10, 2015 02:06
-
-
Save thomasJang/5ba2ad963b9c6b3f91b8 to your computer and use it in GitHub Desktop.
regExp replace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url_string = "https://lh3.googleusercontent.com/-6z6mZ1jCGoA/VhVvM9dr_6I/AAAAAAAAVwU/djxcLHi-KLY/Ic42/IMG_2553.jpg"; | |
console.log(url_string); | |
url_string = url_string.replace(/(\w*)[\\\/]\w*\.\w*$/, function(match, folder){ | |
return folder + '-thomas' + match.substr(folder.length); | |
}); | |
console.log(url_string); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment