Rumah > Soal Jawab > teks badan
大家讲道理2017-04-17 15:57:00
-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
的正则匹配不能够只匹配部分,要匹配完全(理解)。
==update==
如果前面的路径很长,可以这样子匹配
find . -regextype posix-extended -regex '.*autojump.(ba|z)?sh'