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

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

asp.net - Configuring WCF Services in Code WCF 4.5 -