Everything_SetRegex

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
hyadav
Posts: 3
Joined: Wed Jan 06, 2021 11:22 am

Everything_SetRegex

Post by hyadav » Wed Jan 06, 2021 11:34 am

Hi,

I am using 1.4.1.1002 version and via Everything SDK, calling API Everything_SetRegex in my program.

I have some files in c:\test\ folder in my device.

Case 1:

Everything_SetRegex(TRUE);
Everything_SetSearch("c:\\test\\*");
Everything_Query(TRUE);

-> doesnt return any results



Case 2:

Everything_SetRegex(FALSE);
Everything_SetSearch("c:\\test\\*");
Everything_Query(TRUE);

-> returns list of files in results


Question: Everything_SetRegex(TRUE) should enable regex and we should get results with wildcard search but in my case Everything_SetRegex(FALSE) is doing the wildcard searches.

Am I missing something?

NotNull
Posts: 2578
Joined: Wed May 24, 2017 9:22 pm

Re: Everything_SetRegex

Post by NotNull » Wed Jan 06, 2021 11:55 am

hyadav wrote:
Wed Jan 06, 2021 11:34 am
Everything_SetSearch("c:\\test\\*");
From the Everything regex help:
* Matches the preceding element zero or more times
So you are searching for multiple \\\\

Try this instead:

Code: Select all

Everything_SetSearch("c:\\test\\");
- or -

Code: Select all

Everything_SetSearch("c:\\test\\.*");

hyadav
Posts: 3
Joined: Wed Jan 06, 2021 11:22 am

Re: Everything_SetRegex

Post by hyadav » Wed Jan 06, 2021 12:17 pm

Thanks for the reply.

Everything_SetSearch("c:\\test\\");
with Everything_SetRegex(TRUE) -> didnt return anything

Everything_SetSearch("c:\\test\\");
with Everything_SetRegex(FALSE) -> returned files list


Everything_SetSearch("c:\\test\\.*");
-> doesnt return any list with both Everything_SetRegex(TRUE) OR Everything_SetRegex(FALSE)

NotNull
Posts: 2578
Joined: Wed May 24, 2017 9:22 pm

Re: Everything_SetRegex

Post by NotNull » Wed Jan 06, 2021 12:34 pm

Ah, I see : a \ is already specified as \\
In that case. doubling them should do the trick:

Code: Select all

Everything_SetSearch("c:\\\\test\\\\");
Everything_SetSearch("c:\\\\test\\\\.*");

(as you might have noticed, I have no prior experience with the SDK functions :))

hyadav
Posts: 3
Joined: Wed Jan 06, 2021 11:22 am

Re: Everything_SetRegex

Post by hyadav » Wed Jan 06, 2021 1:27 pm

Thanks for the reply.

The problem is not with slashes. The problem is with using wildcard in search string.

Using a wildcard in search string returns results when I have set Everything_SetRegex(FALSE)

Using a wildcard in search string DOESNT returns results when I have set Everything_SetRegex(TRUE) --> ideally this should have enabled regex search but it didnt.

therube
Posts: 2816
Joined: Thu Sep 03, 2009 6:48 pm

Re: Everything_SetRegex

Post by therube » Wed Jan 06, 2021 4:53 pm

A Windows wildcard (if you will) is,
*
.
- match any sequence of characters
A RegEx wildcard (if you will) is,
.*
.
- match any character
.
zero or more times
*


So the wildcards you specify (* or .*) need to match how you're searching ("Windows" or RegEx).

Post Reply