Hi everybody.
I've long wondered, is it possible to do the following?
Say we have items "apple cider" and "dandelion wine". For queries "ac", "ra" (not in order), or "pr" (note the lack of spaces between letters) I'd like to get "apple cider". And also, for "dw", "wa", and — importantly — "dd" I'd like to get "dandelion wine". I think this could be summarized as treating each letter as if it was spaced, but also letter count being meaningful. I hope this makes sense, I can provide other examples to show what I mean, I'm sure these weren't exhaustive.
(Please note that my main goal is to get the amount of typing down, so while I'm interested in whether this can be done at all, for this to be useful to me I would need to be able to automate away the regexes, or however this could be achieved, and only type in the letters.)
[Solved] Is This Pattern Matching Behavior Possible?
[Solved] Is This Pattern Matching Behavior Possible?
Last edited by postfreq on Sun Jan 14, 2024 6:59 pm, edited 1 time in total.
Re: Is This Pattern Matching Behavior Possible?
See Search modifier for substring matching
However, this will not search for the typed letters in a different order.
FWIW, I use the following to search for starting letters of words.
(np will not find notepad, but will find "this is Not a Problem")
(requires Everything 1.5 )
(I will spare you the details of the search query as there is some trickery going on to make this work)
However, this will not search for the typed letters in a different order.
FWIW, I use the following to search for starting letters of words.
(np will not find notepad, but will find "this is Not a Problem")
Code: Select all
Name = Whatever you like
Search = regex:(^|\W)#[regexreplace:$param:,".","$0.*?\\W"#]:*
Macro = whatever suits you.
(I will spare you the details of the search query as there is some trickery going on to make this work)
Re: Is This Pattern Matching Behavior Possible?
Oh these are very close! In fact, they are so close that I realised this does not in fact reduce the amount of typing for me, my intuition was way off. Sorry for troubling y'all. But I'm so glad to learn of these preprocessing magics, they seem to be powerful indeed.
By trickery do you mean the bits of regex that are responsible for selecting beginnings of words? I can't quite read it, but I'm bookmarking this to study it again when I need advanced regex processing.
Thank you!
By trickery do you mean the bits of regex that are responsible for selecting beginnings of words? I can't quite read it, but I'm bookmarking this to study it again when I need advanced regex processing.
Thank you!
Re: [Solved] Is This Pattern Matching Behavior Possible?
That too, but the devil was in the details: the trickery is in the start and end of the search.
\W means a non-word character. It can't be at the start or ending of the search query, so I had to add some extra "stuff".
You can create a filter with these and instead of typing a macro -- for example: short:dsotm to find "The Dark Side Of The Moon" -- you can also assign a keyboard shortcut to that filter, like Alt-S.
Then typing ALT-S will enable this filter. Now you only need to type "dsotm".
Typing ALT-S again will revert to your default Everything filter.
Maybe that helps typing less ...
BTW: I just realized I also have written a verion where the "words" can be in any order: "dtmos" will also find ""The Dark Side Of The Moon".
Let me know if interested.
If it helps:study it again when I need advanced regex processing
dsotm expands to regex:(^|\W)d.*?\Ws.*?\Wo.*?\Wt.*?\Wm.*?\W*
Re: [Solved] Is This Pattern Matching Behavior Possible?
Oh yeah, I did do that. Sorry if I wasn't clear, I meant the whole approach, this way of pattern matching, didn't actually help me type less. I misjudged how common most letters are among the files I'm filtering, so I have to enter way more characters this way. But also, for setting these as filters: I really like sectioning off my queries with "folder-name\", there's no way to exclude that or some other part of the query from the preprocessor, is there? In this case macros allow more control.You can create a filter with these and instead of typing a macro ... Maybe that helps typing less
But anyway, these might well help in other cases, I find myself using Everything for more and more tasks lately. So I'm really glad to have these options, and please do share the expander for "dtmos", I'm very interested.
With that previous one, I maybe get some of it?
Code: Select all
regex:(^|\W)#[regexreplace:$param:,".","$0.*?\\W"#]:*
regex:(^|\W)e.*?\Wc.*?l.*?
1. Why does \W need to be escaped there? (Which is what I assume the second slash is for.)
2. Does $0 loop through each letter somehow? When would we use $1, $2, etc?
Re: [Solved] Is This Pattern Matching Behavior Possible?
Running out of time, so the short version (maybe others step in to answer your other questions)
Code: Select all
Search = #[regexreplace:$param:,".","regex:(^|\\W)$0 "#]: