Page 1 of 1

Everything_SetRegex

Posted: Wed Jan 06, 2021 11:34 am
by hyadav
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?

Re: Everything_SetRegex

Posted: Wed Jan 06, 2021 11:55 am
by NotNull
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\\.*");

Re: Everything_SetRegex

Posted: Wed Jan 06, 2021 12:17 pm
by hyadav
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)

Re: Everything_SetRegex

Posted: Wed Jan 06, 2021 12:34 pm
by NotNull
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 :))

Re: Everything_SetRegex

Posted: Wed Jan 06, 2021 1:27 pm
by hyadav
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.

Re: Everything_SetRegex

Posted: Wed Jan 06, 2021 4:53 pm
by therube
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).