RegEx Search

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
lxman
Posts: 2
Joined: Mon Sep 30, 2019 4:07 pm

RegEx Search

Post by lxman »

Hello,

I am trying to understand the regex capabilities of Everything, and would like help understanding the following:

If I enter "\.tlb" (obviously without the quotes) I have returned a list of files which does appear to be all of the type libraries on my system.
I note in the results that I have a number of them which begin with the letter f.
I modify my regex to "f+\.tlb" (which I believe should be these same type libraries, just beginning with the letter f) and now I have zero results.
I have looked under help and the regex syntax, and it appears that I am using your particular flavor of regex correctly to accomplish what I want.
Is there something that I am not understanding correctly about this process?

Thank you,

Michael
ovg
Posts: 294
Joined: Thu Oct 27, 2016 7:19 pm

Re: RegEx Search

Post by ovg »

Your regex leads to: search for one or more letter f followed by literal . (dot) followed by literal tlb.
try ^f.*\.tlb (begin with f followed by any character any times followed by literal .tlb)

Try online regex tester/learning www.regex101.com
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: RegEx Search

Post by raccoon »

Alternately, you can leave Regex Search turned off, and use one or more patterns in your search using the regex: prefix.

regex:^f regex:\.tlb$

regex:^f .tlb

regex:^f.*\.tlb$

I'm not sure about all the edge cases like supporting space characters in the regex pattern. Think maybe optional /pattern/ quoting support should be added to explicit the beginning and end of a pattern, and enable modifier support.

Match Path has to be turned off to support anchors at filename boundaries.
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: RegEx Search

Post by NotNull »

raccoon wrote: Mon Sep 30, 2019 11:42 pm I'm not sure about all the edge cases like supporting space characters in the regex pattern.
Enclose the regular expression in double quotes or use \s instead of a space.
For example to find "c:\Program Files", use:
regex:"ram files$"
or
regex:ram\sfiles$

Otherwise a space will be seen as the end of the regular expression.


Note:
  • Regular expressions in Everything are case-insensitive. That is different from most other regex engines.
    If you want to do a case-sensitive search, add the case: modifier to your query. Example:
    case: regex:"ram Files$"

    - or -
    Enable Match Case (Menu:Search > Match Case )
  • Everything uses the PCRE (Perl Compatible Regular Expression) engine.

raccoon wrote: Mon Sep 30, 2019 11:42 pm Match Path has to be turned off to support anchors at filename boundaries.
What do you mean by that?
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: RegEx Search

Post by raccoon »

NotNull wrote: Tue Oct 01, 2019 12:25 pm
raccoon wrote: Mon Sep 30, 2019 11:42 pm Match Path has to be turned off to support anchors at filename boundaries.
What do you mean by that?
When you have Match Path (Ctrl+U) enabled, PCRE only sees the entire full path of every file, but does not (also) see just the filename. This means that your use of anchors (ie. ^ and $) will be bound against the full paths. When you disable Match Path, then PCRE only sees the filenames. This will change the behavior of the ^ anchor: either leading the drive letter, or leading the first character of the filename.

Seems like you can also use most PCRE in-pattern modifiers, such as (?i) and (?-i) for selective case-insensitive and case-sensitive matches.

regex:"(?-i)\.Exe$"
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: RegEx Search

Post by NotNull »

Ah, now it's clear. Thanks!
lxman
Posts: 2
Joined: Mon Sep 30, 2019 4:07 pm

Re: RegEx Search

Post by lxman »

Very good explanation as to why I was not getting my expected results. Thank you.
Post Reply