扫码关注官方订阅号
认证高级PHP讲师
-regextype type Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line. Currently-implemented types are emacs (this is the default), posix-awk, posix-basic, posix-egrep and posix- extended.
这个参数会影响,-regex [pattern]的匹配行为,类似使用不同的方言来解析正则表达式。经过我的实验,我觉得这么写
find . -regextype posix-extended -regex './autojump.(bash|zsh|sh)' 或者 find . -regextype posix-extended -regex './autojump.(ba|z)?sh'
./auto...的./是不能省略的,find的正则匹配不能够只匹配部分,要匹配完全(理解)。
./auto...
./
find
==update==如果前面的路径很长,可以这样子匹配
find . -regextype posix-extended -regex '.*autojump.(ba|z)?sh'
如果使用find * 然后再配合egrep,lz你怎么看?
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这个参数会影响,-regex [pattern]的匹配行为,类似使用不同的方言来解析正则表达式。
经过我的实验,我觉得这么写
./auto...的./是不能省略的,find的正则匹配不能够只匹配部分,要匹配完全(理解)。==update==
如果前面的路径很长,可以这样子匹配
如果使用find * 然后再配合egrep,lz你怎么看?