How to use wildcard in content: ?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
byzod
Posts: 8
Joined: Thu Oct 19, 2023 10:17 am

How to use wildcard in content: ?

Post by byzod »

I try to search content of text file and it's not working as expected, I thought the string after
content:
is literal so wildcards is not supported but then I found it's not literal search too, then I get confused

Reproduce:
  1. Create
    1.txt
    and
    2.txt
    in test folder (
    K:\Down\z
    in my case)
  2. Content of those text file:
    1.txt

    Code: Select all

    a<>b
    a==b
    a<b
    
    2.txt

    Code: Select all

    alt:gt:b
    a==b
    alt:b
    
  3. Search terms
    path:K:\Down\z content:{string}
    where the {string} and result is:
    {string} expected literal expected wildcard actual result
    a?b none 1.txt none
    alt:b 2.txt 1.txt 2.txt
    a<>b 1.txt none none
    alt:gt:b 2.txt 1.txt none
2.png
2.png (35.32 KiB) Viewed 2181 times
void
Developer
Posts: 15350
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to use wildcard in content: ?

Post by void »

Please use double quotes (") around your string to treat it literally.


a?b
content: does not support wildcards by default.
Wildcard characters are treated literally.

Use the wildcard: search modifier to enable content wildcards.

For example:

wildcard:content:*a?b*
nowhole:wildcard:content:a?b

content:
wildcard:
no-whole:


alt:b
2.txt is the expected result.


a<>b
Group expansion is doing something odd here.
I'll have this fixed in the next alpha update.

Everything 1.4 breaks the search term on >

For now, please try content:"a<>b"


alt:gt:b
gt: expands to >
Please use double quotes to escape gt:
content:"alt:gt:b"
void
Developer
Posts: 15350
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to use wildcard in content: ?

Post by void »

Everything 1.5.0.1361a fixes an issue with group expansion.

content:a<>b will no longer expand to: content:ab

non-filename string search functions will require an OR operator (|) for group expansion.
For example:

content:gr<a|e>y
byzod
Posts: 8
Joined: Thu Oct 19, 2023 10:17 am

Re: How to use wildcard in content: ?

Post by byzod »

void wrote: Wed Nov 29, 2023 9:36 am Please use double quotes (") around your string to treat it literally.

Thanks for the help! Just curious about the default behavior of
content:
;)
I want to add a macro or alias for
wildcard:content:
(
wc:
for example, the original term is too long), how should I do this in 1.4? My work pc has no privilege to upgrade everything so it's still 1.4

btw I forget to ask last time
what is the
search:
in step 3
Change the Search to: path:search:
and why it's needed? Didn't found it in the doc
what is
<search>
and why it's needed in the step 4?...
void
Developer
Posts: 15350
Joined: Fri Oct 16, 2009 11:31 pm

Re: How to use wildcard in content: ?

Post by void »

I want to add a macro or alias for wildcard:content:
To add a wc: macro for wildcards:content:
  • In Everything 1.4, from the Search menu, click Add to filters....
  • Change the Name to: Wildcard Content
  • Change the Search to: wildcards:content:search:
  • Change the Macro to: wc<search>
  • Click OK.

Change the Search to: path:search:
and why it's needed?
what is
<search>
This is the parameter passed to your macro.
It doesn't have to be search:
It can be any name you like.
It's the variable name for the parameter passed to your macro.
I usually always use search.

For example, in the above filter, we use a macro of: wc<search>
and a search of: wildcards:content:search:
These "search" names must match in the macro and search.
The parameter passed to your wc: macro is replaced with the search: text in your filter search.

It's a little convoluted, so in Everything 1.5 it's been replaced with $param:
byzod
Posts: 8
Joined: Thu Oct 19, 2023 10:17 am

Re: How to use wildcard in content: ?

Post by byzod »

void wrote: Thu Nov 30, 2023 9:07 am This is the parameter passed to your macro.
It doesn't have to be search:
It can be any name you like.
It's the variable name for the parameter passed to your macro.
I usually always use search.

It's a little convoluted, so in Everything 1.5 it's been replaced with $param:
Oh I think I understand it
So
Change the [b]Macro[/b] to: wc<search>
works like
wc.call(args)

Change the [b]Search[/b] to: wildcards:content:search:
works like
define_function wc(args){Everything.DoSearch(args)}


Thanks for the explanation :D
Post Reply