为什么locate命令不能将“|”元字符识别为基本正则表达式?

为什么locate命令不能将“|”元字符识别为基本正则表达式?

当我在命令上使用扩展正则表达式时locate效果很好:

└─$ locate --regex "(\.rar|\.zip)"                                                    
/home/kali/Downloads/linux.zip
/usr/lib/jvm/java-11-openjdk-amd64/legal/jdk.zipfs
/usr/lib/jvm/java-11-openjdk-amd64/legal/jdk.zipfs/ASSEMBLY_EXCEPTION
/usr/share/exploitdb/exploits/windows/remote/17419.zip
/usr/share/icons/Flat-Remix-Blue-Dark/mimetypes/scalable/application-vnd.rar.svg
/usr/share/mime/application/vnd.rar.xml
/usr/share/powershell-empire/empire/server/csharp/Covenant/Data/EmbeddedResources/Lib.zip
/usr/share/powershell-empire/empire/server/data/misc/python_modules/keyboard.zip
/usr/share/powershell-empire/empire/server/data/misc/python_modules/mss.zip
/usr/share/set/src/teensy/x10/libraries.zip

但是当我使用基本正则表达式时,locate无法识别|元字符:

└─$ locate --regexp "(\.rar\|\.zip)"                                                     

└─$

我缺少什么?

相关内容