Having the following link:
/C:\Users\xxx\Desktop\yyy\public\assets\1634648850202.jpg
How do i extract 1634648850202.jpg?
i tried:
const lastplace = thisUrl.substring(thisUrl.lastIndexOf("\"));
This does not work, because the backslash is recognized as a functional character (is this the right term?)
Here are 2 Questions from my side:
Common way:
thisUrl.split(/\/|\\/).pop() // 1634648850202.jpg
I also recommend to split url/path by both slashes (/,\) 'cause of different enviromnents/systems uses diffrent character.
UPD: just make your \ double to handle it (you're right, it's a escape character), like this:
''.lastIndexOf('\\')
Also you need do the same when you initiate your string:
const thisUrl = '/C:\\Users\\xxx\\Desktop\\yyy\\public\\assets\\1634648850202.jpg';