Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua 中拆分文件路径 #51

Open
shuaijinchao opened this issue Dec 6, 2021 · 0 comments
Open

Lua 中拆分文件路径 #51

shuaijinchao opened this issue Dec 6, 2021 · 0 comments
Labels

Comments

@shuaijinchao
Copy link
Owner

代码

string.match([[/mnt/tmp/myfile.txt]], "(.-)([^\/]-%.?([^%.\/]*))$")
-- "/mnt/tmp/" "myfile.txt"    "txt"

string.match([[/mnt/tmp/myfile.txt.1]], "(.-)([^\/]-%.?([^%.\/]*))$")
-- "/mnt/tmp/" "myfile.txt.1"  "1"

string.match([[c:temptestmyfile.txt]], "(.-)([^\/]-%.?([^%.\/]*))$")
-- "c:\temp\test\"  "myfile.txt"    "txt"

string.match([[/test.i/directory.here/filename]], "(.-)([^\/]-%.?([^%.\/]*))$")
-- "/test.i/directory.here/"   "filename"  "filename"

参考文章

https://www.orcode.com/question/1327367_k8b368.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant