Mercurial Hosting > luan
diff src/luan/modules/host/Hosting.luan @ 1716:b82767112d8e
add String.regex
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 24 Jul 2022 23:43:03 -0600 |
parents | cd2a0c41b23f |
children | 0a06d59578aa |
line wrap: on
line diff
--- a/src/luan/modules/host/Hosting.luan Sat Jul 23 21:53:04 2022 -0600 +++ b/src/luan/modules/host/Hosting.luan Sun Jul 24 23:43:03 2022 -0600 @@ -8,7 +8,8 @@ local print = Io.print or error() local Rpc = require "luan:Rpc.luan" local String = require "luan:String.luan" -local matches = String.matches or error() +local contains = String.contains or error() +local starts_with = String.starts_with or error() local substring = String.sub or error() local split = String.split or error() local Logging = require "luan:logging/Logging.luan" @@ -43,7 +44,7 @@ end for _, here_child in ipairs(here.children()) do local name = here_child.name() - if not matches(name,[[^\.]]) then + if not starts_with(name,".") then process(there,there.children[name],here_child) there.children[name] = nil end @@ -73,7 +74,7 @@ my_file.is_file() or error("'"..file.."' is not a file") local my_file_string = my_file.to_string() local my_dir_string = my_dir.to_string().."/" - matches( my_file_string, [[^\Q]]..my_dir_string..[[\E]] ) or error "file must be in dir" + contains( my_file_string, my_dir_string ) or error "file must be in dir" my_file_string = substring(my_file_string,#my_dir_string+1) local path = {split( my_file_string, "/" )} path[#path] = nil