1

When i use extended regex on locate command work well:

└─$ 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

But when i use basic regex, locate not recognize | metacharcater:

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

└─$

What am I missing?

2
  • 2
    | isn't part of POSIX BREs, and neither is \|, so that might well be the reason. If you have an ERE that works and you can use it, why not just use it? Commented Jun 18, 2023 at 15:19
  • I just wondered. Thank you for your response. @ilkkachu Commented Jun 18, 2023 at 15:22

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.