0

How to get the image name with regex?

https://bumbu.me/assets/images/2019/09/Extensions-Management-inspect-3-background-html.png How to get the name of the image (Extensions-Management-inspect-3-background-html.png) from the url using regex?

31st May 2020, 5:19 PM
Hassan Raza
Hassan Raza - avatar
2 Answers
+ 3
Or this one 😊 const link = "www.somesite.com/moretext/need-to-match-this.png"; console.log(link.match(/[^/]*$/)) //"need-to-match-this.png"
31st May 2020, 7:06 PM
Russ
Russ - avatar
+ 1
Try this pattern: "^.*/(.*$)" (don't know how to implement it in JS though) https://code.sololearn.com/c8wxN3e4gQsZ/?ref=app
31st May 2020, 5:41 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar