蚂蚁路径风格正则表达式替换
问题描述:
是否有蚂蚁路径样式正则表达式的替代?蚂蚁路径风格正则表达式替换
对我来说似乎是java org.springframework.util.AntPathMatcher不能处理“|”在正则表达式中。
有没有办法来写蚂蚁路径样式正则表达式,检查路径是否符合给定的任何模式?
例如,我想检查给定的路径是否符合下列任何一种模式。
[ “/富/我”, “/酒吧/我”, “/ foobar的/我”]
答
Ant的filename
选择正常工作与在正则表达式模式|
。
<fileset id="testpath" dir="${parent.dir}">
<filename regex="/foo/me|/bar/me|/foobar/me" />
</fileset>
<echo>${toString:testpath}</echo>
https://ant.apache.org/manual/Types/selectors.html#filenameselect