string - Get file name from URL using Lua -


how file name url using lua string manipulations.

i have url

https://thisisarandomsite.com/some_dir/src/blah/blah/7fd34a0945b036685bbd6cc2583a5c30.jpg

and want 7fd34a0945b036685bbd6cc2583a5c30.jpg, can random site site name not static.

try this:

local str = "https://thisisarandomsite.com/some_dir/src/blah/blah/7fd34a0945b036685bbd6cc2583a5c30.jpg" local name = str:match( "([^/]+)$" ) 

you can customise match pattern this guide.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -