how to search content with exact terms?

Discussion related to "Everything" 1.5 Alpha.
Post Reply
Skrell
Posts: 11
Joined: Wed Jun 19, 2013 1:19 am

how to search content with exact terms?

Post by Skrell »

Is there currently implemented a way to search for 2 exact words in a file? So for instance, if I wanted to search for "class xyz" but wasn't sure how many spaces were between class and xyz and also there were other class names like xyz_interface how could I define this search?
void
Developer
Posts: 16742
Joined: Fri Oct 16, 2009 11:31 pm

Re: how to search content with exact terms?

Post by void »

Regex will give you the most control:

regex:content:\bclass\b\s+\bxyz\b

regex: = enable regular expressions
\b = word break
\s = space
\s+ = one or more spaces



Alternatively:

ww:content:class ww:content:xyz

ww: = whole words



ww:content:xyz_interface
Skrell
Posts: 11
Joined: Wed Jun 19, 2013 1:19 am

Re: how to search content with exact terms?

Post by Skrell »

void wrote: Mon Dec 11, 2023 10:18 pm Regex will give you the most control:

regex:content:\bclass\b\s+\bxyz\b

regex: = enable regular expressions
\b = word break
\s = space
\s+ = one or more spaces



Alternatively:

ww:content:class ww:content:xyz

ww: = whole words



ww:content:xyz_interface
I had NO idea you could chain together macros like this!!! Awesome!
Also ww:content: does not appear to work at all. It still treats it as a partial match.
void
Developer
Posts: 16742
Joined: Fri Oct 16, 2009 11:31 pm

Re: how to search content with exact terms?

Post by void »

Please make sure regex is unchecked under the Search menu.
regex will override whole words.

Please make sure no other search options are checked under the Search menu.



Everything 1.5 treats _ as punctuation.

Is this what you are seeing?
-I have on my TODO list to treat _ as a word when using ww: with content:
Skrell
Posts: 11
Joined: Wed Jun 19, 2013 1:19 am

Re: how to search content with exact terms?

Post by Skrell »

Please see attached pics proving that ww is being ignored.
Attachments
3.png
3.png (21.02 KiB) Viewed 4175 times
2.png
2.png (39.47 KiB) Viewed 4175 times
1.png
1.png (33.69 KiB) Viewed 4175 times
Skrell
Posts: 11
Joined: Wed Jun 19, 2013 1:19 am

Re: how to search content with exact terms?

Post by Skrell »

Oh duh, I see the problem is exactly what you said! Hoping your modification to make '_' part of words comes soon! :) TY for help!
Skrell
Posts: 11
Joined: Wed Jun 19, 2013 1:19 am

Re: how to search content with exact terms?

Post by Skrell »

void wrote: Mon Dec 11, 2023 10:18 pm Regex will give you the most control:

regex:content:\bclass\b\s+\bxyz\b

regex: = enable regular expressions
\b = word break
\s = space
\s+ = one or more spaces



Alternatively:

ww:content:class ww:content:xyz

ww: = whole words



ww:content:xyz_interface
1 more question on this -> ww:content:class ww:content:xyz
Does this search for both terms on the same line or in the same file? If the same file, is there a way (without a regex) to have both terms match on the same line for it to be considered a successful search?
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: how to search content with exact terms?

Post by NotNull »

Skrell wrote: Tue Jan 02, 2024 10:28 pm If the same file, is there a way (without a regex) to have both terms match on the same line for it to be considered a successful search?
Yes, by using the eachline: search modifier:

Code: Select all

eachline:content:<class xyz>

eachline:
Post Reply