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
Post a Comment