Allow the "number:" verb to stand alone. Natural number magic.

Discussion related to "Everything" 1.5 Alpha.
Post Reply
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Allow the "number:" verb to stand alone. Natural number magic.

Post by raccoon »

Currently the number: function can only work in combination with regexmatchN: substring matches.

Please allow number: to work as a stand-alone search verb that looks for natural numbers in any simple search query.

number:>42 --> The file or path contains a numeric value greater than 42. Eg: "foobar107.exe"

number:2002..2004 --> The file or path contains a numeric value between (and including) 2002 through 2004. Eg: "foobar2004.exe" or "foobar2004-02-11.exe", but not "foobar20040211.exe" as that contains the natural number 20,040,211.

Everything 1.5 already detects these natural numbers and knows of their values. (right?)

Being able to use number: outside the confines of regex: would allow for finding matches when multiple natural numbers appear in a single file name/path. This is almost impossible to do with a regular expression pattern without multiple branches for numerous regexmatchN's.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by void »

number: is a search modifier.

Using number: will convert text to a number for comparison.

Please allow number: to work as a stand-alone search verb that looks for natural numbers in any simple search query.
added to my TODO list.
Thank you for your suggestion.

It might have to work by matching the first digits found.

Everything 1.5 already detects these natural numbers and knows of their values. (right?)
Only when sorting.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by void »

Everything 1.5.0.1285a adds a number-range: search function to search filenames for a number (a sequence of digits: 0-9) in a specific range.

The entire filename is searched until a matching number is found.

Example usage:
number-range:2011..2021
number-range:10..100 !number-range:50..60

It's similar to the char-range: search function which looks for a character in specific range.


I ran into to many issues trying to use the number: search modifier to perform the above number range search.
number: is an alias to atof: which converts text to a real number (can be signed and contain a decimal place).

I also added support for number:, atof: and atoi: for use on their own. (without a property)
number:, atof: and atoi: will only convert a number at the start of the text.

number:, atof: and atoi: will also convert hex with the 0x prefix to decimal.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by void »

Everything 1.5.0.1286a removes the number: -> tonumber: alias and adds the number: -> number-range: alias.

For example:
number:2010..2020



Everything 1.5.0.1286a adds the whole-filename: search modifier support to char-range:

For example:
wfn:char-range:a..c
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by raccoon »

void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by void »

Thank you for the ref raccoon,

I am just now going through all the search modifiers and documenting them.

number: was previously undocumented.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by raccoon »

void wrote: Tue Nov 30, 2021 6:05 amnumber: was previously undocumented.
You will find it here. Ctrl+F regexmatch0
You'll need to update this document now to say tonumber: instead.
As well as Help > Search Syntax > Modifiers
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by void »

Updated, thanks.
harryray2
Posts: 1104
Joined: Sat Oct 15, 2016 9:56 am

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by harryray2 »

I can't quite make this out..what does tonumber: do?
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by raccoon »

harryray2 wrote: Tue Nov 30, 2021 12:51 pm I can't quite make this out..what does tonumber: do?
See my ref'd link above. viewtopic.php?f=2&t=10785&p=41552#p41552

It allows us to examine whether a regex back-ref regexmatchN matches a number value. It converts it To a Number for math operator testing, just like we can do with size: which is also a number. You can use math operators like >=, <=, >, <, =, and the special 10..20 range operator. tonumber: would be called casting a data type in a formal programming language; converting a string to an integer.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by void »

Everything 1.5.0.1287a adds hexnumber: and number: highlighting.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by raccoon »

Do number: (number-range:), hexnumber:, and tonumber: have an upper limit integer value that they support, or do they allow for infinitely "big numbers"?

is hexnumber: an alias for something else, maybe hexnumber-range: or number-range-hex:?
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Allow the "number:" verb to stand alone. Natural number magic.

Post by void »

Everything uses a 64bit unsigned integer internally.

The maximum range is:
0..18446744073709551615

-or-

0..0xffffffffffffffff


hexnumber: is an alias for hex-number-range:


tonumber: uses a 64bit fixed point integer and has the following maximum range:
-9223372036854.775807..9223372036854.775807
Post Reply