-- 匹配不带文件后缀的local function get_file_name(filepath)return string.match(filepath, ".+/([^/]*)$")end-- 匹配带文件后缀的local function get_file_name(filepath)return string.match(filepath, "(.+)/[^/]*%.%w+$") --*nix system--return string.match(filepath, “(.+)\\[^\\]*%.%w+$”) — windowsend
.+/([^/]*)$具体正则是如何实现的?
.+/是什么意思?匹配多个字符加一个/?([^/]*):匹配0或多个非/的字符- ``:匹配字符串结尾
所以按理说有2、3就已经够了,从结尾开始的多个非/的字符?
