RegEx - Get All Characters After Last Slash in URL

后端 未结 8 2165
无人共我
无人共我 2020-11-29 07:00

I\'m working with a Google API that returns IDs in the below format, which I\'ve saved as a string. How can I write a Regular Expression in javascript to trim the string to

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 07:38

    Just in case someone else comes across this thread and is looking for a simple JS solution:

    id.split('/').pop(-1)

提交回复
热议问题