Answer the question
In order to leave comments, you need to log in
How to take the value after the last "/" from the URL if the entire length of the url is unknown?
There are URLs of different lengths:
http://000.000.000.00:3000/index.html
file:///android_asset/www/index.html
file:///data/user/0/files/android_asset/www/index.html
How can I take the value of index.html from these examples? (or together with a slash: /index.html)
Answer the question
In order to leave comments, you need to log in
bla = 'file:///data/user/0/files/android_asset/www/index.html'.split('/')
bla[bla.length - 1]
Or regular season
bla = 'file:///data/user/0/files/android_asset/www/index.html'.match(/(?<=\/)\w*\.\w*$/gmi) //Без слеша
bla = 'file:///data/user/0/files/android_asset/www/index.html'.match(/\/\w*\.\w*$/gmi) //Со слешем
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question