Search Preprocessor

Discussion related to "Everything" 1.5 Alpha.
Locked
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Search Preprocessor

Post by void »

The Search Preprocessor is an advanced feature to rewrite your searches in Everything 1.5.
Searches passed from the command line are automatically expanded.
Searches are automatically expanded when executing an Everything query.



Syntax

[function:arg1,arg2,arg3,...]
"an exact phrase"

Search operators are escaped in the expanded result.



The follow syntax is also supported and is expanded before any other syntax:
#[function:arg1,arg2,arg3,...#]:

The following can be used to escape a block of text:
#[:a literal block of text#]:

Search operators are preserved in the expanded result.



The follow syntax is also supported by the multi-file-renamer:
<function:arg1,arg2,arg3,...>



Parsing a function terminates at a space or OR operator (|) when no []{}<>() call syntax is used.
Use double quotes (") to escape spaces and |.



Expanded text from [function:arg1,arg2,arg3,...] is automatically quoted when used from the search box or command line.



function: and [function:] are "termprocessors" - Search operators in the output are escaped.
#function: is "preprocessor" - Search operators in the output are processed.
Preprocessor is applied first, then the termprocessor for each search term.



Examples

clipboard:
[len:abc] => 3
[len:"[abc]"] => 5
[eval:1<<17] => 131072
[rand:%10][rand:%10][rand:%10] => (random 3 digits)
[pathpart:"c:\windows\system32"] => "c:\windows"
[day:now:] => (the current day: 1-31)
[formatfiletime:[edate:now:,-12],"YYYYMMDD"] => (same date as now with the previous year)
[define:list="Red,Green,Blue,Yellow"][element:list:,",",[randbetween:1,[elementcount:list:,","]]] (pick a random color name)
#define<:f<x>=#<:#if<:"#x:>1",#eval<:#x:*#f<:#eval<:#x:-1#>:#>:#>:,1#>:#>:#>:#f:<5> (factorial 5)



Registry Examples

[HKEY_CLASSES_ROOT\*\shell\Find Dupes in Everything\command]
"C:\Program Files\Everything\Everything64.exe" -s size:[getsize:"%1"]



Command Line Examples

Set the search to the current date as ISO8601:
Everything64.exe -s [year:now:]-[text:month:now:,00]-[text:day:now:,00]

Set the search to the basename of a full path:
Everything64.exe -s nopath:[basename:"c:\windows\notepad.exe"]

Set the search to a size search for the size of a specified file by filename:
Everything64.exe -s size:[getsize:"c:\windows\notepad.exe"]



Character Entities
#num:#
#quot:"
#lt:<
#gt:>
#comma:,
#colon::


Functions

If the search starts with /function: and ENTER is pressed, the search will be replaced with the expanded preprocessor text.
For example, typing in the search /len:abc and pressing ENTER will replace the search with 3.



[abs:expression]
Return the absolute value of expression.
Example: [abs:2-3] => 1



[acos:x]
Return the inverse cosine of x in radians.



[acosh:x]
Return the inverse hyperbolic cosine of x.



[add-trailing-path-separator:filename]
Add a trailing path separator to the end of filename.
Does nothing if the filename already contains a trailing path separator.
The appended path separator character will depend on the filename.
Example: [add-trailing-path-separator:c:] => c:\
Example: [add-trailing-path-separator:"C:\Program Files"] => C:\Program Files\



[and:expression1,expression2,expression3,...]
Returns the logical AND result of all expressions.
Returns 1 if all expressions are TRUE, 0 otherwise.
Example: #and:<#find:<my,my search>,#find:<search,my search>> => 1
Example: [and:1,1,0] => 0



[asin:x]
Return the inverse sine of x in radians.



[asinh:x]
Return the inverse hyperbolic sine of x.



[atan:x]
Return the inverse tangent of x in radians.



[atan2:x,y]
Return the angle between the line segment 0,0 -> x,y in radians.



[atanh:x]
Return the inverse hyperbolic tangent of x in radians.



[basename:path]
[filename:path]
Returns the basename from the full path and filename.
Example: [basename:C:\Windows\explorer.exe] => explorer.exe
Example: [basename:"C:\Windows\Notepad.exe"] => Notepad.exe



[ceiling:x,[factor]]
Round up x to the nearest integer multiple of specified significance.



[char:expression]
Return the character for the specified unicode code point.
Example: [char:65] => A
Example: [char:97] => a
Example: [char:0x2d] => -



[clean:text]
Returns text with non-printable characters removed.
Example: [clean:?abc?] => abc



[clipboard:]
Returns the text content from the clipboard.
Can only be used from the main search window.
The search is dynamic, copying text will update your results in real-time.
Example: clipboard:
Example: [clipboard:]
Example: dm:get-date-modified:clipboard:



[code:character]
Returns the character code from the specified character.
Example: [code:A] => 65



[concatenate:text1,text2,text3,...]
[concat:text1,text2,text3,...]
Concatenate all text.
Example: [concat:abc,123,foo,bar] => abc123foobar



[cos:x]
Return the cosine of x in radians.



[cosh:x]
Return the hyperbolic cosine of x.



[crc32:text]
Calculate the CRC32 hash from the specified text.
Example: [crc32:abc123] => CF02BB5C



[crc64:text]
Calculate the CRC64 hash from the specified text.
Example: [crc64:abc123] => FBE99605494BA1AF



[date:year,month,day]
Returns the specified date as a filetime.
Example: [date:2024,2,29] => 133485030000000000



[datevalue:date-or-filetime]
Returns the local date part from the specified filetime as a filetime.
Example: [datevalue:"2023-03-02T17:39:56"] => 133221510000000000



[day:date]
Returns the day from date.
date can be in YYYY-MM-DD hh:mm:ss format or a filetime.
Example: [day:now:]



[dec2hex:decimal-value,[zero-padding]]
Returns the hex value from the specified decimal value.
Example: [dec2hex:255] => FF
Example: [dec2hex:15,2] => 0F



[define:definition]
Defines the function or variable and returns an empty string.
If the function or variable is already defined, it is replaced with the new definition.
The definition is lost when you exit Everything.
Syntax: name=value
Syntax: name<parameter list>=function-body
Example: [define:x=123]
Example: [x:] => 123
Example: [define:mysum<a,b>="[eval:#a:+#b:]"]
See -define: command line option.



[degrees:x]
Convert x in radians to degrees.



[directory-exists:filename]
Returns 1 if the specified filename is a directory on disk, 0 otherwise.
Can only be used from the main search window.
Example: [directory-exists:C:\Windows] => 1
Example: [directory-exists:"C:\Windows\Notepad.exe"] => 0



[edate:date-or-filetime,month-offset]
Returns a filetime from the specified date-or-filetime with the specified month-offset.
Example: [edate:2023-03-02,-1] => 133197318000000000
Example: [formatfiletime:[edate:2023-03-02,-1],"YYYY-MM-DD"] => "2023-02-02"



[element:list,delimiter-characters,n]
Returns the nth element (1 based) from a delimited list.
Example: [element:"Red;Green;Blue",";",[randbetween:1,3]]



[element-count:list,delimiter-characters]
Returns the number of elements in a delimited list.
Example: [elementcount:"Red;Green;Blue",";"] => 3



[eval:expression]
Evaluate a C expression and return the result.
Example: [eval:1+1] == 2
Example: [eval:3*(4+5)] == 27
Example: [eval:1<<17] == 131072



[even:x]
Round up x to the nearest even integer.



[exact:value1,value2]
Returns 1 if value1 is exactly the same as value2, 0 otherwise.
Example: [exact:abc,abc] => 1
Example: [exact:abc,Abc] => 0



[exe-location:]
Return the location of your Everything.exe.
Example: [exe-location:] => C:\Program Files\Everything



[exp:x]
Euler's number to the power of x.



[extension:filename]
Return the extension from the specified filename, including the dot.
Example: [extension:New Text Document.txt] => .txt
Example: [extension:Everything.exe] => .exe



[file-exists:filename]
Returns 1 if the specified filename is a file on disk, 0 otherwise.
Can only be used from the main search window.
Example: [file-exists:C:\Windows] => 0
Example: [file-exists:"C:\Windows\Notepad.exe"] => 1



[filetime:date-time]
Returns the date-time as a filetime.
Example: [day:[eval:[filetime:now:] + 360000000000]] => (tomorrow's day)



[filetime-to-local-filetime:date-time]
Returns the specified date-time as a filetime in local time.



[fixed:number,number-of-places,[suppress_separator=0]]
Format a number with a specified number of decimal places.
Example: [fixed:3.141592,3] => 3.141
Example: [fixed:3141592,0,1] => 3141592
Example: [fixed:3141592,0,0] => 3,141,592
Example: [fixed:3141592,0] => 3,141,592



[floor:x,[factor]]
Round x down to the nearest integer multiple of specified significance.



[format-duration:duration,[format]]
Format a 100 nanosecond duration.
format syntax is [[hh:]mm:]ss
The duration_format ini setting is used for the duration format if it is not specified.



[format-file-attributes:number]
Format a number into an alpha attribute list.



[format-filetime:filetime,[format]]
Format a 100 nanosecond filetime to local time.
format is the standard Windows Date Time format.
The date_format and time_format ini settings are used for the date/time format if it is not specified.
Example: [formatfiletime:$date-modified:,"yyyy-MM-dd\THH:mm:ss.SSS"] => 2024-01-20T15:32:49.323



[format-filetime-utc:filetime,[format]]
Format a 100 nanosecond filetime in UTC.
format is the standard Windows Date Time format.
The date_format and time_format ini settings are used for the date/time format if it is not specified.



[format-number:number]
Format a number with digit grouping.
Example: [format-number:123456789] => 123,456,789



[format-size:size,[format]]
Format a file size.
format: 0=auto, 1=bytes, 2=KB, 3=MB.
The size_format ini setting is used for the size format if it is not specified.



[get-attributes:filename]
Get the file attributes from the specified filename.
Example: [get-attributes:"C:\Windows\Notepad.exe"] => 32



[get-date-created:filename]
Get the date created filetime from the specified filename.
Example: [get-date-created:"C:\Windows\Notepad.exe"]



[get-date-modified:filename]
Get the date modified filetime from the specified filename.
Example: [get-date-modified:"C:\Windows\Notepad.exe"]



[getenv:name]
Get the environment variable value from the specified name.
Can only be used from the main search window.
Example: [getenv:windir] => C:\Windows
Example: [getenv:"ProgramFiles"] => C:\Program Files



[get-long-path-name:short-path]
Get the long path from the specified short path.
Can only be used from the main search window.
Example: [get-long-path-name:C:\Progra~1] => C:\Program Files



[get-property:filename,property-canonical-name]
Get the specified property as a raw value from the specified filename.
Can only be used from the main search window.
Example: [get-property:"C:\Windows\Notepad.exe",size] => (size of Notepad.exe in bytes)
Example: [get-property:"C:\Windows\Notepad.exe",date-modified] => (Date Notepad.exe was last modified as a filetime)
Example: size:[get-property:"C:\Windows\Notepad.exe",size]
Example: dm:[get-property:"C:\Windows\Notepad.exe",date-modified]
Example: C:\Windows\ sha256:[get-property:"C:\Windows\Notepad.exe",sha256]



[get-setting:setting-name]
Return the current value for the specified configuration setting.
Example: [get-setting:app_data] => 1



[get-size:filename]
Get the size of the file from the specified filename.
Example: [get-size:"C:\Windows\Notepad.exe"] => (size of Notepad.exe in bytes)



[has-basename:path]
[has-filename:path]
Returns 1 if the specified path includes a basename, 0 otherwise.
Example: [has-basename:"C:\Windows\Notepad.exe"] => 1
Example: [has-basename:""] => 0



[has-extension:filename]
Returns 1 if the specified filename contains an extension, 0 otherwise.
Example: [has-extension:"C:\Windows\Notepad.exe"] => 1
Example: [has-extension:"C:\Windows"] => 0



[has-parent-path:path]
Returns 1 if the specified path contains a parent, 0 otherwise.
Example: [has-parent-path:"C:\Windows\Notepad.exe"] => 1
Example: [has-parent-path:"C:"] => 0



[has-relative-path:path]
Returns 1 if the length of the root of path is 0, 0 otherwise.
Example: [has-relative-path:"C:\Windows\Notepad.exe"] => 1
Example: [has-relative-path:"C:"] => 0



[has-root-directory:path]
Returns 1 if the specified path is a root, 0 otherwise.
Example: [has-root-directory:"C:\Windows"] => 1
Example: [has-root-directory:"Windows\Notepad.exe"] => 0
See #root-directory:



[has-root-name:path]
Returns 1 if the specified path is a root, 0 otherwise.
Example: [has-root-name:"C:\Windows"] => 1
Example: [has-root-name:"Windows\Notepad.exe"] => 0
See #root-name:



[has-root-path:path]
Returns 1 if the length of the root of path is non-zero, 0 otherwise.
Example: [has-root-path:"C:\Windows"] => 1
Example: [has-root-path:"Windows\Notepad.exe"] => 0
See #root-path:



[has-stem:path]
Returns 1 if the length of the stem from path is non-zero, 0 otherwise.
Example: [has-stem:"C:\Windows"] => 1
Example: [has-stem:".exe"] => 0
See #stem:



[hex2dec:hex-value]
Returns the decimal value from the specified hex value.
Example: [hex2dec:ff] => 255



[hour:date-time]
Returns the hour from date-time.
Example: [hour:now:]



[if:expression,value1,value2]
Returns value1 if the expression is non-zero, value2 otherwise.
Example: [if:eval:[hour:now:]>=12,"Good afternoon","Good morning"]



[ifdef:name,value1,value2]
Returns value1 if name is defined, value2 otherwise.
Example: [ifdef:myvar,#myvar:,""]



[iflen:text,value1,value2]
Returns value1 if text has one or more characters, value2 otherwise.
Example: [iflen:$album:,$album:,"unknown"]



[ifndef:name,value1,value2]
Returns value1 if name is not defined, value2 otherwise.
Example: [ifndef:myvar,[define:myvar=123]]



[ifs:expression1,value1,expression2,value2,expression3,value3,...]
Returns value1 if the expression1 is non-zero. Otherwise,
Returns value2 if the expression2 is non-zero. Otherwise,
Returns value3 if the expression3 is non-zero.



[include:filename]
Returns the text content from the file specified by filename.
Can only be used from the main search window.
Example: include:"c:\searches\my search.txt"

Ctrl + click the include:... text to select a filename.



[instr:text,search,[start-index]]
[find:search,text,[start-index]]
Returns 0 if the search is not found.
Otherwise, returns the 1 based index of search in text.
Start the search from the optional start-index (1 if omitted).
Example: [find:a,abc] => 1
Example: [find:b,abc] => 2
Example: [find:a,abc,2] => 0
Example: [find:d,abc] => 0



[int:text]
Returns text as an integer.



[is-absolute:filename]
Returns 1 if filename specifies an absolute path. Otherwise,
Returns 0 if filename specifies an relative path.
Example: [is-absolute:C:\Windows\Explorer.exe] => 1
Example: [is-absolute:..\Explorer.exe] => 0



[is-admin:]
Returns 1 if Everything is currently running as administrator.
Otherwise, returns 0 if Everything is currently running as a standard user.
Example: [if:is-admin:,"[Admin]"]



[is-blank:text]
Returns 1 if the specified text is empty, 0 otherwise.
Example: [is-blank:"abc"] => 0
Example: [is-blank:""] => 1



[is-db-read-only:]
Returns 1 if Everything database is currently in read-only mode.
Otherwise, returns 0.
Example: [if:is-db-read-only:,"[Read-only]"]



[is-error:text]
Returns 1 if the specified text is an error value, 0 otherwise.



[is-relative:path]
Returns 1 if the specified path is a relative path, 0 otherwise.
Example: [is-relative:C:\Windows\Explorer.exe] => 0
Example: [is-relative:..\Explorer.exe] => 1



[is-safe-mode:]
Returns 1 if Everything is currently in safe-mode. (no plugins loaded)
Otherwise, returns 0.
Example: [if:is-safe-mode:,"[Safe-mode]"]



[left:text,[n]]
Returns n (default=1) characters from the left of text.
Example: [left:abc123,2] => ab



[len:text]
[strlen:text]
Return the length of text in UTF-16 characters.
Example: [len:abc] => 3
Example: [len:"abc"] => 3



[line-count:text]
Returns the number of lines in text.



[local-filetime-to-filetime:datetime]
Converts a local filetime to filetime in UTC.



[log:x,[base]]
Returns the logarithm of x given a base (10 by default).



[log10:x]
Returns the logarithm of x with base 10.



[lower:text]
Convert text to lowercase.
Example: [lower:ABC] => abc



#lpad:[text,count,character]
Left pad text to count characters with the specified character.
Example: [lpad:abc,5,"*"] => **abc
Example: [lpad:abc123,5,"*"] => abc123



[ltrim:text,characters]
Remove the specified characters from the left of text.
Example: [ltrim:" abc"," "] => abc



[makepreferred:path]
Fixes root paths.
Example: [makepreferred:c:] => C:\



[max:expression1,expression2,expression3,...]
Return the max value from a list of expressions.
Example: [max:1,10,100] => 100



[md5:text]
Calculate the MD5 hash from the specified text.
Example: [md5:abc123] => E99A18C428CB38D5F260853678922E03



[mid:text,start-index,length]
[substr:text,start-index,length]
[substring:text,start-index,length]
Return the substring from text at start index (1 based) with the specified length.
Example: [substr:abc123,2,4] => bc12



[min:expression1,expression2,expression3,...]
Return the minimum value from a list of expressions.
Example: [min:1,10,100] => 1



[minute:date-time]
Returns the minute from date-time.
Example: [minute:now:]
Example: [text:[minute:now:],00]



[mod:x,y]
Returns the modulo of x and y.



[month:date]
Returns the month from date.
Example: [month:now:]
Example: [text:[month:now:],00]



[n:value]
Returns value if value is a number.
Otherwise, returns 0.



[not:expression]
Return the logical NOT value of expression.
Example: [not:0] => 1
Example: [not:1] => 0
Example: [not:len:abc] => 0



[now:]
Returns the current date and time as a filetime.
The current date-time is gathered at the start of the query and does not change between calls.
Example: [text:[hour:now:],00][text:[minute:now:],00]



[or:expression1,expression2,expression3,...]
Returns the logical OR result of all expressions.
Returns 1 if any expression is TRUE, 0 otherwise.
Example: [or:0,0] => 0
Example: [or:0,1] => 1
Example: [or:1,0] => 1
Example: [or:1,1] => 1



[paragraph-count:text]
Returns the number of paragraphs in text.



[path-canonicalize:path]
Normalize the specified path.
Example: [pathcanonicalize:C:\windows\..] == C:



[path-combine:path1,path2]
Append path2 to path1 and return the result.
Includes a path separator if required.
Example: [path-combine:"C:\Program Files","Everything"] => C:\Program Files\Everything
Example: [path-combine:"C:\","Everything"] => C:\Everything



[path-exists:path]
Returns 1 if the path is a file or folder on disk, 0 otherwise.
Can only be used from the main search window.
Example: [path-exists:C:\Windows] => 1
Example: [path-exists:C:\Windows\Explorer.exe] => 1



[path-part:path]
Returns the path part of the specified full path.
Example: [path-part:C:\Windows\Explorer.exe] => C:\Windows



[pi:]
Returns 3.14159265358979323846



[power:base,exp]
Returns the integer power from the integer base and integer exponent.
Example: [power:10,6] => 1000000



[printf:format,arg1,arg2,arg3,...]
Format text.
%d == number
%f == real number
%s == string
%c == character
%x == number as hex
%X == number as hex (with uppercase hex values)
%% == literal %
Example: [printf:"%02d",1] => 01
Example: [printf:"%d:%02d:%02d",21,4,9] => 21:04:09
Example: [printf:"%d%%",99] => 99%
Example: [printf:"%0.3f",3.141592] => 3.141
Example: [printf:"%s%d",abc,123] => abc123
Example: [printf:"0x%08x",65535] => 0x0000ffff
Example: [printf:"%c",65] => A



[proper:text]
Return the title case for text.
Example: [proper:the LAZY fox] => The Lazy Fox



[quote:text]
Returns quoted text for a search term.
Example: #[quote:"abc 123"#]: => "abc 123"



[radians:x]
Convert x in degrees to radians.



[rand:]
Returns a pseudo random number.
Example: [rand:%10]



[rand-between:value1,value2]
Returns a random number between value1 and value2 (inclusive).
Example: [randbetween:10,99]



[regex-escape:text]
Returns text with special regex characters escaped.
Example: regex:[regex-escape:C:\Program Files\Everything] => regex:"C:\\Program Files\\Everything"



[regex-extract:text,search]
Returns text that matches the regular expression.
Returns match 1 if captured.
Otherwise, returns match 0.
Example: [regex-extract:abc123,\d\d\d] => 123



[regex-find:pattern,text,[start-index]]
Returns the 1 based index of the regular expression match.
The pattern is case sensitive.
Example: [regex-find:"bar","foobar"] => 4



[regex-instr:<text,search,[start-index]]
Returns the 1-based index of the first match.
Example: [regex-instr:abc123,[a-z]\d,2] => 3



[regex-match:text,search]
Returns 1 if text matches the specified regular expression, 0 otherwise.
Example: [regex-match:abc123,^a.*3$] => 1



[regex-replace:text,search,new-text]
Replaces all matches of the specified regular expression in text with new-text.
Example: [regex-replace:abc123,\d,x] => abcxxx
Use $0-$9 to recall capture groups.



[regex-search:pattern,text,[start-index]]
Returns the 1 based index of the regular expression match.
The pattern is case insensitive.
Example: [regex-search:"BAR","foobar"] => 4


[relative-path:path]
Return the relative path from the specified path.
Example: [relative-path:C:\Program Files\Everything] => Program Files\Everything



[remove-basename:path]
[remove-filename::path]
Remove the basename from the specified path.
Example: [remove-basename:C:\Windows\Explorer.exe] => C:\Windows



[remove-diacritics:text]
Normalize and remove diacritics from the specified text.
Example: [remove-diacritics:"Æon"] => AEon
Example: [remove-diacritics:"déjà vu] => deja vu




[remove-extension:filename]
Remove the extension from the specified filename.
Example: [remove-extension:C:\Windows\Explorer.exe] => C:\Windows\Explorer
Example: [remove-extension:Explorer.exe] => Explorer
Example: [remove-extension:C:\Windows] => C:\Windows



[remove-trailing-path-separator:path]
Remove any trailing path separator from path.
Example: [remove-trailing-path-separator:C:\] => C:



[repeat:text,n]
[rept:text,n]
Return text repeated n times.
Example: [repeat:ha,3] => hahaha



[replace-basename:path,new-basename]
[replace-filename:path,new-filename]
Replace the basename from path with the new-basename.
Example: [replace-basename:C:\Windows\Explorer.exe,Notepad.exe] => C:\Windows\Notepad.exe



[replace-extension:filename,new-extension]
Replace the extension in filename with the new-extension.
The new extension should include the dot.
Example: [replace-extension:C:\Windows\Explorer.exe,.jpg] => C:\Windows\Explorer.jpg
Example: [replace-extension:Notepad.exe,.png] => Notepad.png



[replace-terms:<terms,new-term-format]
Replace each term with new-term-format.
Use #term: to specify the current term.
Please escape #term: in the new-term-format argument so it is not prematurely expanded.
Example: #replace-terms:#<:abc 123 | foo bar#>:,#<:case:#term:#>: => case:abc case:123 | case:foo case:bar



[right:text,[n]]
Return n characters from the right of text.
Example: [right:abc123,2] => 23



[roman:x]
Convert x to roman numerals.



[root-directory:path]
Return the root name from the specified path.
Example: [root-directory:C:\Windows\Explorer.exe] => \



[root-name:path]
Return the root name from the specified path.
Example: [root-name:C:\Windows\Explorer.exe] => C:



[root-path:path]
Return the root path from the specified path.
Example: [root-path:C:\Windows\Explorer.exe] => C:\



[round:x,[places]]
Round x to the specified number of decimal places.



[round-down:x,[places]]
Round x down to the specified number of decimal places.



[round-up:x,[places]]
Round x up to the specified number of decimal places.



[rpad:text,count,character]
Right pad text to count characters with the specified character.
Example: [rpad:abc,5,"*"] => abc**
Example: [rpad:abc123,5,"*"] => abc123



[rtrim:text,characters]
Remove the specified characters from the right of text.
Example: [rtrim:"abc "," "] => abc



[second:date-time]
Returns the second from date-time.
Example: [second:now:]
Example: [text:[second:now:],00]



[sha1:text]
Calculate the SHA1 hash from the specified text.
Example: [sha1:abc123] => 6367C48DD193D56EA7B0BAAD25B19455E529F5EE



[sha256:text]
Calculate the SHA256 hash from the specified text.
Example: [sha256:abc123] => 6CA13D52CA70C883E0F0BB101E425A89E8624DE51DB2D2392593AF6A84118090



[sha384:text]
Calculate the SHA384 hash from the specified text.
Example: [sha384:abc123] => A31D79891919CAD24F3264479D76884F581BEE32E86778373DB3A124DE975DD86A40FC7F399B331133B281AB4B11A6CA



[sha512:text]
Calculate the SHA512 hash from the specified text.
Example: [sha512:abc123] => C70B5DD9EBFB6F51D09D4132B7170C9D20750A7852F00680F65658F0310E810056E6763C34C9A00B0E940076F54495C169FC2302CCEB312039271C43469507DC



[shell:known-folder-name]
Returns the path of a known folder.
Example: [shell:desktop]
Example: [shell:startup]



[sign:x]
Returns -1 if x is negative, 1 if x is positive and 0 if x is 0.



[sin:x]
Return the sine of x in radians.



[sinh:x]
Return the hyperbolic sine of x in radians.



[sqrt:x]
Returns the square root of x.



[stem:filename]
Return the stem from the specified filename.
Example: [stem:C:\Windows\Explorer.exe] => Explorer
Example: [stem:Notepad.exe] => Notepad



[strcmp:text1,text2]
Compare text1 with text2 and return the result.
Returns < 0 if text1 is less than text2, returns 0 if text1 and text2 are identical, returns > 0 if text1 is greater than text2.
Example: [strcmp:abc,abc] => 0
Example: [strcmp:A,B] => -1
Example: [strcmp:abc,ABC] => 32



[stricmp:text1,text2]
Case insensitive compare text1 with text2 and return the result.
Returns < 0 if text1 is less than text2, returns 0 if text1 and text2 are the same, returns > 0 if text1 is greater than text2.
Example: [stricmp:abc,abc] => 0
Example: [stricmp:abc,ABC] => 0
Example: [strcmp:A,B] => -1



[stringcount:text,search]
Returns the number of occurrences of search in text.
Example: [stringcount:"foo","o"] => 2



[stuff:text,start-index,len,insert-text]
[replace:text,start-index,len,insert-text]
Insert insert-text into text at the specified start index.
The inserted text is repeated until the specified len is filled.
Example: [stuff:abc123,2,2,xx] => abxx23
Example: [stuff:Everything,1,5,No] => Nothing



[substitute:text,search,new-text]
Replace all occurrences of search in text with new-text.
Example: [substitute:abc123,123,xxx] => abcxxx



[sum:expression1,expression2,expression3,...]
Return the sum of all the specified expressions.
Example: [sum:1,2,3] => 6



[switch:expression,case1,value1,case2,value2,case3,value3,...,default-value]
Return value1 if case1 matches expression.
Return value2 if case2 matches expression.
Return default-value if no case matches the expression.
Example: [switch:[weekday:now:],0,"Sunday",1,"Monday",2,"Tuesday",3,"Wednesday",4,"Thursday",5,"Friday",6,"Saturday"]



[t:value]
Returns value if value is text.
Otherwise, returns an empty string.



[tan:x]
Returns the tangent of x in radians.



[tanh:x]
Returns the hyperbolic tangent of x in radians.



#term:
The current term in #replace-terms:
See #replace-terms:



[text:value,format]
Format text.
YY/MM/DD = Date format. Example: 21/1/13
DDDD = Day of the week. Example: Monday
H:MM AM/PM = Time in 12 hour format. Example: 1:37 PM
#,### = Use thousands separator. Example: 1,234,567
000000 = Add leading zeros (0). Example: 000123
Example: [text:2,000] => 002
Example: [text:now:,YYYY-MM-DD]



[textjoin:delimiter,ignore-empty,text1,[text2,...]]
Join text with the specified delimiter and optionally ignore empty text.
Example: [textjoin:";",1,Red,Green,,,Blue] => Red;Green;Blue
Example: [textjoin:";",0,Red,Green,,,Blue] => Red;Green;;;Blue



[time:hour,minute,second]
Returns the specified time as a filetime.
Example: [time:8,30,0] => 306000000000



[timevalue:date-or-filetime]
Returns the local time part from the specified filetime as a filetime.
Example: [timevalue:"2023-03-02T17:39:56"] => 635960000000



[today:]
Returns the current date in YYYY-MM-DD format.
Example: [filetime:today:]



[trim:text,characters]
Remove the specified characters from the left and right of text.
Example: [trim:" abc "," "] => abc



[undef:name]
Undefines the function or variable with the specified name.
Example: [undef:x]
See #define:



[unichar:expression]
Return the character for the specified unicode code point.
Example: [unichar:0x1F44D] => 👍
Example: [unichar:128077] => 👍



[unicode:character]
Return the unicode code point for the specified character.
Example: [unicode:👍] => 128077



[unquote:text]
Removes quotes from text



[upper:text]
Return text as uppercase.
Example: [upper:abc] => ABC
Example: [upper:"foo bar"] => FOO BAR



[utf82hex:text]
Return text as hex data.
Example: [utf82hex:hello] => 68656C6C6F



[utf8len:text]
Return the length of text in UTF-8 bytes.
Example: [utf8len:abc] => 3
Example: [utf8len:👍] => 4



[version:]
Return the Everything version as major.minor.revision.build.
Example: [version:] => 1.5.0.1262



[word-count:text]
Returns the number of words in text.
Example: [word-count:"abc 123"] => 2



[weekday:date]
Returns the week day from date.
0 = Sunday, 1 = Monday, ...
Example: [weekday:now:]



[xor:expression1,expression2,expression3,...]
Returns the logical XOR result of all expressions.
Returns 1 if there is an odd number of non-zero expressions, 0 otherwise.
Example: [xor:0,0] => 0
Example: [xor:0,1] => 1
Example: [xor:1,0] => 1
Example: [xor:1,1] => 0



[year:date]
Returns the year from date.
Example: [year:now:]



Dashes (-) in function names can be omitted.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1306 improves the search preprocessor.

Added [function:parameter] syntax.

For example:

[year:now:]-[text:[month:now:],00]-[text:[day:now:],00]
[getpathpart:shell:startup]

Expanded text will automatically be quoted when using the [function:parameter] syntax from the search box.



Added function:parameter syntax.

For example:
clipboard:
include:"my saved search.txt"
shell:desktop
shell:startup\e

Expanded text will automatically be quoted when using the function:parameter syntax from the search box.




now: now returns a FILETIME instead of YYYY-MM-DD HH:mm:ss text.

For example:

#year:now:
dm:>[now:-600000000]



added getyear:
added getpathpart:
added shell:<known-folder-name>
added ifdef:<name,value1,value2>
added ifndef:<name,value1,value2>
added iflen:<text,value1,value2>
added undef:<name>
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1311a removes getyear: and getpathpart:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1322a adds the following preprocessor search functions:

#regex-find:
#regex-search:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1323a fixes the parameter order with the following preprocessor search functions:

#regex-find:
#regex-search:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1328a adds the following preprocessor functions:

#crc32:
#crc64:
#md5:
#sha1:
#sha256:
#sha384:
#sha512:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1331a adds the following preprocessor functions:

#int: - Returns text as a integer.
#format-filetime-utc: - Format a 100 nanosecond filetime in UTC.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1332a no longer expands terms with the preprocessor for search functions that accept non-filename strings. (eg: content:)

For example:
content:year: will now search for the text "year:" in the file content.

Everything 1.5.0.1332a fixes an issue with expanding terms from a search command.
For example, type in the following and press ENTER:
/format-filetime-utc:now:
will now correctly set the search to the current time in UTC.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1336a adds the following preprocessor functions:

#utf8len:
#is-db-read-only:
#is-safe-mode:
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

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

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1340a adds the following preprocessor functions:

[power:10,7]
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1356a simplifies the preprocessor.

Everything will now do two passes on the search.

The first pass will expand any #[function-name: ... #]: functions.
The search is then broken into search terms.
The second pass will expand any [function-name:...] functions in each search term.



Bookmark and filter searches will apply the same process.



Any [function-name:...] functions inside parameters passed to macros are now expanded and treated as quoted text.
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1372a improves the preprocessor.

Filter and bookmark parameters are enclosed in hidden &paramstart: and &paramend: quotes.

The preprocessor and Everything search will ignore any operators while inside a &paramstart: and &paramend: quote.

This will allow you to pass terms with spaces to an active filter macro.



literal: and !literal: can also be used to escape operators in an Everything search, including quotes (").



[replaceterms:...] will now eat quotes.
[quote:...] will now always quote text.
[unquote:...] can be used to remove quotes from text.



added:
[normalize:]
[stringcount:]
[unquote:]
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1373a removes [normalize:]
void
Developer
Posts: 16745
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search Preprocessor

Post by void »

Everything 1.5.0.1374a fixes an issue with [REGEXEXTRACT:] using regmatch0 when regmatch1 was empty.
[REGEXEXTRACT:] will now use regmatch1, even when the capture is empty.
Locked