Lua and patterns workaround -


i have string contains name of files (including complete fullpath) separated "|", @ end number indicated current file (is player). wanna keep name of files, right have use match function 2 times, 1 separation , other cut out path. wonder if , how possible one. ex. have:

local s = "w:\\videos\\tokyo ghoul\\[tokyo ghoul][ep01]tragedia.mkv|w:\\videos\\tokyo ghoul\\[tokyo ghoul][ep02]incubaciĆ³n.mkv|w:\\videos\\tokyo ghoul\\[tokyo ghoul][ep03]paloma.mkv|w:\\videos\\tokyo ghoul\\[tokyo ghoul][ep04]cena.mkv|2"; 

so do:

for val in s:gmatch('(.-)|')     print(val);     table.insert(list, {             type = "item",             icon = icon;             text = val:match(".*\\(.*)")}); end 

i receive:

[tokyo ghoul][ep01]tragedia.mkv [tokyo ghoul][ep02]incubaciĆ³n.mkv [tokyo ghoul][ep03]paloma.mkv [tokyo ghoul][ep04]cena.mkv 

what want use 1 gmatch function. hope can me.

try

for val in s:gmatch('.-\\(%[.-)|')     print(val) end 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -