java - 向正则表达式过滤器制造商寻求一个好的java“完整路径glob”
问题描述
我需要使用类似于或等效于 .gitignore 文件或 gradle 用于其 FileTree include() 和 exclude() 方法的通用完整路径“glob”过滤器格式来实现目录树遍历器。
ie: "/**/aDirectory/*.foo" "/a/directory/**/*.foo" "/start/a????.d/**/*" etc
That is:
filter = makeFilter("/**/*.foo/**/*.txt")
filter.match("/a/b/c/blah.foo/e/f.txt") == true;
filter.match("/a/b/c/blah.foo/e/f.jpg") == false;
filter.match("/a/b/c/blah/e/f.txt") == false;
filter.match("/blah.foo/e/f.txt") == true;
filter.match("/blah.foo/f.txt") == true;
also allowing "?" to represent a single character that must be present.
过滤器可以采用不带分隔符的字符串数组来表示路径。
是否为此制定了标准?一个好的实现?
如果是这样,我在哪里可以找到它:)
解决方案
推荐阅读
- arrays - 按姓氏对字符串进行排序:Ruby
- audiokit - 带有 AKMIDISampler (sf2) 的 AKAppleSequencer 在 iO14 中一次只播放一个音符
- angular - ngx-socket-io ng 测试“NullInjectorError:没有 WrappedSocket 的提供者!”
- arrays - 区分 TypeScript 中的数组类型
- sql - 如何在 SQL 上划分两组?
- arrays - 提取这些对象的名称并添加到 React Native 中的新数组?
- sql-server - SSAS - 多维 - 预测选项
- java - 无法解析项目 org.alfresco:alfresco-transformer-base:jar:2.3.5-SNAPSHOT 的依赖关系:
- java - Kinesis putrecord() 抛出无法解组异常
- swift - AnyCancellable.store(in:) 与组合