Column Formulas

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

Column Formulas

Post by void »

Everything 1.5.0.1322a adds column formulas.



With column formulas you can customize the formatting and display of properties.



Column formulas support C style expressions.

For example, show the size in bits in column 1:
column1:=$size:*8 add-column:column1



There are 16 assignable columns.
Column values can be accessed with the Column 0 - Column 9 or Column A - Column F properties.


To set the column formula, include the following in your search:
column1:=formula

where 1 is the column number (0-9) and formula is the column formula.

For example:
column1:=1+1
<foo column1:=1> | <bar column1:=0>



Properties can be referenced with $property-name:
Use - for spaces in the property name.

For example:
column1:=$size:*8
column1:=day($date-modified:)
column1:=len($regular-expression-match-1:)



Most Excel text functions, Integer functions and logical functions are supported.

Most preprocessor search functions are supported.

The following functions are supported:
  • ABS(x) - absolute value of x.
  • ADD_TRAILING_PATH_SEPARATOR(path) - add a trailing path separator to path.
  • AND(x,y,z,...) - logical AND of all parameters.
  • BASENAME(path) - name part of path.
  • CHAR(x) - character from Unicode point x.
  • CLEAN(string) - remove non-printable characters from string.
  • CODE(ch) - Unicode point from character ch.
  • CONCAT(x,y,z,...) - concatenate all parameters into one string.
  • CONCATENATE(x,y,z,...) - concatenate all parameters into one string.
  • CRC32(text) - compute the crc32 sum of text.
  • CRC64(text) - compute the crc64 sum of text.
  • DAY(date-or-filetime) - day value from a date or filetime.
  • DATEVALUE(date-or-filetime) - local date part from the specified filetime as a filetime.
  • DEC2HEX(num,zero-padding) - convert decimal num to hexidecimal
  • EDATE(filetime/date,month-offset) - get the filetime with a month offset from the specified filetime/date.
  • ELEMENT(list,separator-characters,index) - get the list item from the specified 1 base index.
  • ELEMENT_COUNT(list,separator-characters) - returns the number of items in a list.
  • EVAL(expression) - evaluate the expression and return the result.
  • EXACT(a,b) - text compare a with b.
  • EXTENSION(path) - extension part of path with dot (.)
  • FILENAME(path) - name part of path.
  • FILETIME(date) - convert a date to a filetime.
  • FIND(search,text,[start-index]) - case sensitive find search inside text.
  • FORMAT_DURATION(time,[format]) - format 100-nanosecond time duration.
  • FORMAT_FILE_ATTRIBUTES(windows-file-attributes) - format file attributes
  • FORMAT_FILETIME(filetime,[format]) - format a windows filetime.
  • FORMAT_FILETIME_UTC(filetime,[format]) - format a windows filetime in UTC.
  • FORMAT_NUMBER(num) - add commas to large numbers.
  • FORMAT_SIZE(size,[format]) - format size
  • HAS_BASENAME(path) - returns 1 if path has a basename. Otherwise, returns 0.
  • HAS_EXTENSION(path) - returns 1 if path has an extension. Otherwise, returns 0.
  • HAS_FILENAME(path) - returns 1 if path has a filename. Otherwise, returns 0.
  • HAS_PARENT_PATH(path) - returns 1 if path has a parent path. Otherwise, returns 0.
  • HAS_RELATIVE_PATH(path) - returns 1 if path has a relative path. Otherwise, returns 0.
  • HAS_ROOT_DIRECTORY(path) - returns 1 if path has a root directory. Otherwise, returns 0.
  • HAS_ROOT_NAME(path) - returns 1 if path has a root name. Otherwise, returns 0.
  • HAS_ROOT_PATH(path) - returns 1 if path has a root path. Otherwise, returns 0.
  • HAS_STEM(path) - returns 1 if path has a stem. Otherwise, returns 0.
  • HEX2DEC(hex-value) - returns a hexidecimal value as a decimal value.
  • HOUR(date-or-filetime) - hour of the specified date or filetime.
  • IF(x,y,z) - if x is TRUE (or non-zero), return y. Otherwise, return z.
  • IFLEN(x,y,z) - if the length of x is larger than 0, return y. Otherwise, return z.
  • IFS(condition1,result1,condition2,result2,...) - if condition1 is true return result1, if condition2 is true return result2, ...
  • INT(text) - convert text to an integer.
  • IS_ABSOLUTE(path) - returns 1 if path is absolute. Otherwise, returns 0.
  • IS_BLANK(text) - returns 1 if the text is blank/empty. Otherwise, returns 0.
  • IS_RELATIVE(path) - returns 1 if path is relative. Otherwise, returns 0.
  • LEFT(text,[count]) - returns the left part of the text.
  • LEN(text) - returns the length of the string in UTF-16 characters.
  • LOWER(text) - returns the text as lowercase.
  • LOWERCASE(text) - returns the text as lowercase.
  • LPAD(text,pad-char) - left pad text with the specified pad-char.
  • LTRIM(text) - remove spaces from the left of text.
  • MAKE_PREFERRED(path) - fix path separators.
  • MAX(x,y,z,...) - return the maximum value.
  • MD5(text) - compute the md5 sum of text.
  • MID(text,start,length) - return a substring.
  • MIN(x,y,z,...) - return the minimum value.
  • MINUTE(date-or-filetime) - minute value from a date or filetime.
  • MONTH(date-or-filetime) - month value from a date or filetime.
  • NOT(x) - return logical NOT of x.
  • NOW() - return the current filetime.
  • OR(x,y,z,...) - return the logical OR of all parameters.
  • PATH_CANONICALIZE(path) - return the canonicalized path.
  • PATH_COMBINE(path-part,name-part) - combine path and name with the correct path separator.
  • PATH_PART(path) - return the path part from the specified path.
  • POWER(base,exp) - return the power from the specified base and exponent.
  • PRINTF(format,...) - c style printf
  • PROPER(text) - convert text to titlecase.
  • RAND() - return a random number.
  • RANDBETWEEN(x,y) - return a random number between x and y (inclusive)
  • REGEX_ESCAPE(text) - return text with special regex characters escaped.
  • REGEX_EXTRACT(text,pattern) - return the regex match.
  • REGEX_FIND(pattern,text) - return the 1-based index of the first case sensitive regex match.
  • REGEX_MATCH(text,pattern) - returns 1 if the specified pattern is found. Otherwise, returns 0.
  • REGEX_REPLACE(text,pattern,replacement-text) - replace pattern in text with replacement-text.
  • REGEX_SEARCH(pattern,text) - return the 1-based index of the first case insensitive regex match.
  • REGEX_UNESCAPE(text) - return text with special regex characters unescaped.
  • RELATIVE_PATH(path) - returns the relative path of the specified path.
  • REMOVE_BASENAME(path) - removes the basename from path.
  • REMOVE_DIACRITICS(text) - removes diacritics from text.
  • REMOVE_EXTENSION(path) - removes the extension from path.
  • REMOVE_FILENAME(path) - removes the basename from path.
  • REMOVE_TRAILING_PATH_SEPARATOR(path) - removes the trailing path separator from path.
  • REPEAT(text,count) - repeat text, count times.
  • REPLACE(old,start,len,new) - replace part of old with new.
  • REPLACE_BASENAME(path,new-basename) - return path with a new basename.
  • REPLACE_EXTENSION(path,new-extension) - return path with a new extension.
  • REPLACE_FILENAME(path,new-basename) - return path with a new basename.
  • REPT(text,count) - repeat text, count times.
  • RIGHT(text,[count]) - returns the right part of the text.
  • ROOT_DIRECTORY(path) - return the root directory from the specified path.
  • ROOT_NAME(path) - return the root name from the specified path.
  • ROOT_PATH(path) - return the root path from the specified path.
  • RPAD(text,pad-char) - left pad text with the specified pad-char.
  • RTRIM(text) - remove spaces from the right of text.
  • SEARCH(search,text,[start-index]) - case insensitive find search inside text.
  • SECOND(date-or-filetime) - second value from a date or filetime.
  • SHA1(text) - compute the sha1 sum of text.
  • SHA256(text) - compute the sha256 sum of text.
  • SHA384(text) - compute the sha384 sum of text.
  • SHA512(text) - compute the sha512 sum of text.
  • STEM(path) - return the stem part of the specified path.
  • STRCMP(a,b) - case sensitive string compare.
  • STRICMP(a,b) - case insensitive string compare.
  • STRLEN(text) - returns the length of the string in UTF-16 characters.
  • STRLWR(text) - returns the text as lowercase.
  • STRUPR(text) - returns the text as uppercase.
  • STUFF(text,start,len,text-to-insert) - return text with text-to-insert inserted.
  • SUBSTITUTE(text,old,new) - replace old with new in text.
  • SUBSTR(text,start,length) - return a substring.
  • SUBSTRING(text,start,length) - return a substring.
  • SUM(x,y,z,....) - return the sum of all parameters.
  • SWITCH(value,case1,value1,case2,value2,....,default-value) - return a value from a matching case.
  • TEXT(text,format) - format text.
  • TEXTJOIN(separator-character,ignore-empty,x,y,z,....) - concatenate parameters with a separator character.
  • TIMEVALUE(date-or-filetime) - local time part from the specified filetime as a filetime.
  • TITLECASE(text) - convert text to titlecase.
  • TODAY() - returns the current date.
  • TRIM(text) - remove spaces from the start and end of text.
  • UNICHAR(num) - returns the Unicode character from the specified Unicode point.
  • UNICODE(ch) - returns the Unicode point from the specified Unicode character.
  • UPPER(text) - returns the text as uppercase.
  • UPPERCASE(text) - returns the text as uppercase.
  • UTF82HEX(text) - returns text as hex data.
  • UTF8LEN(text) - returns the length of text in UTF-8 bytes.
  • VERSION() - returns the current version of Everything.
  • WEEKDAY(date-or-filetime) - weekday value from a date or filetime.
  • XOR(x,y,z,...) - returns the XOR result of all parameters.
  • YEAR(date-or-filetime) - year value from a date or filetime.


Underscores (_) in function names can be omitted.



To show column 1:
  • Right click the result list column header and click Add columns....
  • Select Column 1 and click OK.
-or-

Include the following in your search:
addcolumn:column1



Columns values are updated in real-time.
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Assignable Columns

Post by void »

Everything 1.5.0.1319a fixes an issue with column2:= (to column9:=) not matching anything.
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1322a adds support for Excel formulas.

Properties can be referenced with <property name> + ':'
Use - for spaces in the property name.

For example:

column1:=size:*8 add-column:column1
column1:=1+1 add-column:column1
column1:=TEXTJOIN(";",TRUE,size:,formatfiletime(dm:,"YYYY-MM-DD\THH:mm:ss")) add-column:column1



Renamed "Assignable Columns" to "Column Formulas".



Column Formulas are now updated in real-time.
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1327a adds the following column formula functions:

crc32(text) - compute the crc32 sum of text
crc64(text) - compute the crc64 sum of text
md5(text) - compute the md5 sum of text
sha1(text) - compute the sha1 sum of text
sha256(text) - compute the sha256 sum of text
sha384(text) - compute the sha384 sum of text
sha512(text) - compute the sha512 sum of text
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1331a adds the following column formula functions:

INT(text) - convert text to a number
FORMAT_FILETIME_UTC(filetime,[format]) - format a windows filetime in UTC.
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1332a fixes an issue with ?: conditionals eating the : as literal.

Everything 1.5.0.1332a adds support for $property-name:
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Possible use of column formulas to rank results:

foo bar column1:=regexmatch($fullpath:,"^C:\\Users\\My User Name\\")?1:0 sort:column1-descending;dm

Files under C:\Users\My User Name\ are listed first.
Files are then sorted by date modified descending.
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1336a adds the following formula functions:

utf8len() - calculate the length of string in UTF-8 bytes.

Added Column A - Column F
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1338a fixed a crash when using Column A - Column F
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1339a adds the following functions:

formatfiletime(edate("2023-03-02",-1)) => 2023-02-02
datevalue("2023-03-02") => 133221510000000000
timevalue("2023-03-02t16:57:23") => 610430000000
dec2hex(15,2) => 0f
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

Everything 1.5.0.1340a adds the following functions:

power(10,7) => 10000000
DerekZiemba
Posts: 29
Joined: Thu Sep 27, 2018 4:46 pm

Re: Column Formulas

Post by DerekZiemba »

Do the regex functions work?
I thought the following would fill the column with the matched text. And if this were to work, how would you select named groups?
column1:=REGEX_EXTRACT($Name:, ".+") add-column:column1

Also how do you use the RegularExpressionMatch columns? I tried:
  • Thought maybe the match groups were perhaps populated when REGEX_EXTRACT is run:
    REGEX_EXTRACT($Name:, "\W*(\w+)") add-column:RegularExpressionMatch0 add-column:REgularExpressionMatch1
  • Tried setting the variable:
    <$regular-expression-match-1:=REGEX_EXTRACT($Name:, ".+")> add-column:Column0 add-column:RegularExpressionMatch0 add-column:RegularExpressionMatch1
  • Various combination of earlier attempts like:
    Column0:=REGEX_EXTRACT($Name:, ".+") add-column:Column0 add-column:RegularExpressionMatch0 add-column:REgularExpressionMatch1
The following is a very rough expression (gets me ~<90% there) of what I eventually want to run. The goal is to pick out poorly formatted usernames & names of people from file names, the names could be Snake (_|.|\s delimited), Pascal, Kebab, or Camel case. After I verified the basics worked, the next step was to figure out how to select the 'name' group and fill the column with it - not sure if that's possible though? Flavor is PCRE2(PHP>=7.3), I think that's the implementation in Everything...

Code: Select all

(?|
 (?:^(?!(?:\#[A-Za-z]+\s)+))(?|
  (?:(?:(?:(?<name>[A-Z][a-zA-Z]{3,}(?:[\s_]?[A-Z][a-zA-Z]{2,}){1,2}[0-9]{0,3})(?=\s*?\-|,\s+|\s+\&|\_\W|\W+[0-9]{2,}|\W+?(?:(?:[\s\.\-]+|^|\b)(?i:a|at|as|are|and|after|&|\+|have|how|I[tsn]?|me|my|or|of|on|the|that|to|do|for|final|when|with)(?:[\s\.\-]+|$|\b))))(?=.+$)))
   |(?:(?:[0-9]?(?<name>[a-zA-Z]{3,}[0-9]{0,3}_?(?:[a-zA-Z]{3,}[0-9]{0,3}_?)))(?=(?:\_[a-zA-Z]|[\-\s]\b)))
   |(?:(?<name>[A-Z][a-z]{2,}\s[A-Z][a-z]{2,}_?[0-9]{0,3}))
   |(?:(?:^|(?<!\d)\s-\s?)(?<name>[a-z_]{3,}[_\-\s]?(?!(?:(?:[\s\.\-]+|^|\b)(?i:a|at|as|are|and|after|&|\+|have|how|I[tsn]?|me|my|or|of|on|the|that|to|do|for|final|when|with)(?:[\s\.\-]+|$|\b)))[a-z]{2,}\d{0,3}_?)(?=_|,|\s[&\d]|\s?[\-\#]))
   |(?:(?<name>[a-z]{3,}\s[a-z]{2,})(?=\s?(?:[\-\&\[\#•]|[\(\[]?\d{3,}|(?:(?:[\s\.\-]+|^|\b)(?i:a|at|as|are|and|after|&|\+|have|how|I[tsn]?|me|my|or|of|on|the|that|to|do|for|final|when|with)(?:[\s\.\-]+|$|\b)))))
   |(?:(?<name>[a-zA-Z]{3,}_?[a-zA-Z]{3,}_?[0-9]{0,3}))
   |(?:(?<name>[a-z]{3,}[_\s]?[a-z]{2,}_?[0-9]{0,3}))
  )
  |(?<name>[A-Z][a-zA-Z]{3,}[\s\_][A-Z][a-zA-Z]{3,}(?=[,-]))
  |(?:\#[A-Za-z]+\s)+(?<name>\b[A-Z][a-zA-Z]{3,}[\s\_][A-Z][a-zA-Z]{3,}(?=\s))
)
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

There's a space after the ,

Please try the following:

Code: Select all

column1:=REGEX_EXTRACT($Name:,".+") add-column:column1
DerekZiemba
Posts: 29
Joined: Thu Sep 27, 2018 4:46 pm

Re: Column Formulas

Post by DerekZiemba »

Thank You!
In case someone else ends up finding this via google, I went with the following (but with all spacing removed). I was pleasantly surprised I could nest the functions!:

Code: Select all

#define<:extracted-user-name=#{: 
add-column:Column0   
column0:=REGEX_EXTRACT(
             REGEX_EXTRACT($Name:,
             "(?|
               (?:(?>\#[A-Za-z]+[\s0-9]*\s)?(?>(?i:\&|\+|[ai][tnms]?|are|and|by|have|how|m[ey]|o[rfn]|the|that|[dt]o|for)(?:[\s\.\-]+|\b))?
               (?<name>(?:[A-Za-z]{2,}[\sA-Z\_][a-zA-Z0-9_]+)|(?:[a-zA-Z]{3,}\.?[a-zA-Z0-9_]+)|(?:[a-zA-Z0-9]{10,}))
               (?=[,\s\-]+(?:(?i:\&|\+|[ai][tnms]?|are|and|by|have|how|m[ey]|o[rfn]|the|that|[dt]o|for)(?:[\s\.\-]+|\b))?))
              )"
             ),
         "^(?:\#[A-Za-z]+[\s0-9]*\s)?(.+)"
         ) 
#}:#>: 
Then added that function to my list of defines filter.

Code: Select all

#define<:extracted-user-name=#{: add-column:Column0   column0:=REGEX_EXTRACT(REGEX_EXTRACT($Name:,"(?|(?:(?>\#[A-Za-z]+[\s0-9]*\s)?(?>(?i:\&|\+|[ai][tnms]?|are|and|by|have|how|m[ey]|o[rfn]|the|that|[dt]o|for)(?:[\s\.\-]+|\b))?(?<name>(?:[A-Za-z]{2,}[\sA-Z\_][a-zA-Z0-9_]+)|(?:[a-zA-Z]{3,}\.?[a-zA-Z0-9_]+)|(?:[a-zA-Z0-9]{10,}))(?=[,\s\-]+(?:(?i:\&|\+|[ai][tnms]?|are|and|by|have|how|m[ey]|o[rfn]|the|that|[dt]o|for)(?:[\s\.\-]+|\b))?)))"),"^(?:\#[A-Za-z]+[\s0-9]*\s)?(.+)") #}:#>: 
#define<:corrupt-office=#{:  <ext:<docx;xlsx;doc;xls> <size:"<1kb"|!file-signature:<"application/zip";"application/x-ole-storage">|hex:startwith:binarycontent:0000|hex:endwith:binarycontent:0000>>  #}:#>: 
#define<:corrupt=#{:  #corrupt-office:|<<content-type:|perceived-type:|ext:<doc;docx;dotx;xltx;xls;xlsx;xlsb;pps;ppt;pptx;pub;rtf;md;pdf;jpg;jpeg;png;heic;avi;mp4;mkv;3g2;3gp;3gp2;3gpp;flv;m4v;mpg;mpeg;mov;ogv;webm;wmv;exe;dll;msi;cab;jar>> <hex:startwith:binarycontent:00000000|hex:endwith:binarycontent:00000000>>  #}:#>:
#define<:filtered=#{: #only-progs:"Applied\" #no-protected: #no-temp: #no-modules: #no-blockchain: #no-progfiles: #no-appdata-junk:  #}:#>: 
#define<:only-progs<x>=#{: <!<<#x:> !ext:<exe;lnk;cmd>> !end-with:".ni.exe" > #}:#>: 
#define<:no-sys=#{: #only-progs:attrib:S #only-progs:owner:<SYSTEM;"TrustedInstaller">  #only-progs:"C:\Windows\" !"C:\Windows\Assembly\" !regex:"(LOCK|CURRENT)$"  #}:#>:  
#define<:no-ignored=#{: #only-progs:attrib:I !ext:<file;index;wdseml;pdb;odlsent;ri> !"AppData.Roaming.Thunderbird-profile\" !ads-names:"com.dropbox.ignored"    #}:#>:  
#define<:no-hidden=#{: #only-progs:attrib:H #only-progs:path:regex:"\\\..+($|\\)"  #}:#>:  
#define<:no-protected=#{: #no-sys: #no-ignored: #no-hidden: #}:#>:  
#define<:no-temp=#{: #only-progs:<"\TEMP\"|"\tmp\"|"\Spotify\">  #}:#>:  
#define<:no-modules=#{: !"\Packages\" !"\Package Cache\" !"site-packages\"   #only-progs:<"\go\pkg\mod\"|"\.nuget\"|"\node_modules\"|"\ruby\gems\"|"\python*\lib\">  #}:#>:   
#define<:no-blockchain=#{: !"\Raven\chainstate\" !"\Raven\blocks\" !"\Daedalus Mainnet\chain\"  #}:#>:  
#define<:no-progfiles=#{: #only-progs:<"C:\ProgramData\"|"C:\Program Files\"|"C:\Program Files (x86)\"|"msys64\"|"mingw32\"|"steamapps\">   #}:#>: 
#define<:no-appdata-junk=#{: !<"C:\Users\*\AppData\" <"\SourceServer\"|"\*Cache*\"|"\User Data\"|"\TypeScript\"|"\resources\"|"\workspaceStorage\"> > #}:#>:  
#define<:exe=#{: ext:<exe;msi;cpl;vsix;jar> #}:#>:  
#define<:bin-lnk=#{: <ext:lnk regex:ShortcutTarget:"\.(exe|msi|msm|msp|mst|rll|dll|cpl|cab|sys|ocx|vsix|bin|jar|scr)$"> #}:#>:  
#define<:bin=#{: <#bin-lnk:|ext:<exe;msi;msm;msp;mst;rll;dll;cpl;cab;sys;ocx;vsix;bin;jar;scr>>  #}:#>: 
#define<:book=#{: ext:<pdf;epub;mobi>  #}:#>:  
#define<:audio=#{: ext:<aac;ac3;amr;flac;m4a;mp3;wav;wma>  #}:#>:  
#define<:sound=#{: ext:<aif;aifc;aiff;au;cda;dts;fla;m1a;m2a;m3u;mid;midi;mka;mod;mp2;mpa;ogg;opus;ra;rmi;snd;umx;voc;weba;xm>  #}:#>:  
#define<:icon=#{: ext:<ani;cur;ico;svg;tga;tif;tiff;wmf;wmp>  #}:#>:  
#define<:movie=#{: ext:<avi;mp4;mkv>  #}:#>:  
#define<:film=#{: #movie: length:>15m height:>500 dimensions:   #}:#>:   
#define<:video=#{: <#movie:|ext:<3g2;3gp;3gp2;3gpp;flv;m4v;mpg;mpeg;mov;ogv;webm;wmv>>  #}:#>:    
#define<:photo=#{: ext:<dng;heic;jpg;jpeg;png>  #}:#>:  
#define<:image=#{: <#photo:|ext:<bmp;heif;svg;tif;tiff;tga;webp>>  #}:#>:      
#define<:gif=#{: ext:<apng;gif;gifv>  #}:#>:   
#define<:photoshop=#{: <ext:<psb;psd> > #}:#>:     
#define<:picture=#{: <#photo:|#image:|#gif:|#photoshop:> #}:#>:    
#define<:note=#{: ext:<one;note;md;rtf;nfo> #}:#>:  
#define<:excel=#{: ext:<xl;xlsx;xlsm;xlsb;xlam;xltx;xltm;xls;xla;xlt;xlm;xlw;sldm;sldx>  #}:#>:    
#define<:word=#{:  ext:<doc;docm;docx;dot;dotm;dotx;thmx;odt;wpd;wps;tex;pdf> #}:#>:    
#define<:powerpoint=#{: ext:<potx;potm;ppam;ppsm;ppsx;pps;ppt;pptm;pptx;sldm;sldx> #}:#>:    
#define<:office=#{: <#word:|#powerpoint:|#excel:|ext:one>  #}:#>:  
#define<:logs=#{: <ext:<log;etl;dmp>| file:regex:"log\.?\d*$" | <regex:file:name:"(?<!Dia|cata)log(?!o|in)" <ext:<"">|perceived-type:text> valid-utf8:>>  #}:#>:    
#define<:config=#{:  <ext:xml;yml;json;ini>|<ext:settings;manifest;vsixmanifest>|<ext:config;jsconfig;tsconfig;editorconfig;dotsettings>|<ext:gitconfig;gitmodules;gitignore;gitattributes>|<ext:profile;bash_profile>|<regex:"\.[a-z]{2,12}rc$">  #}:#>:  
#define<:plaintext=#{:  <<perceived-type:text>|<content-type:"text"|wildcards:content-type:<"*script*";"*xml*";"*json*">>|<ext:txt;md;rtf>|<ext:nfo !hex-contents:000000>|<regex:"CHANGELOG|README|CONTRIBUTING">|<case:regex:"(^[[:upper:]]+$)">|<case:endwith:<INSTALL|BUGS>>>  #}:#>: 
BTW, off topic for here, but is there a better way or place to define my macros & have them available everywhere? Currently I place the block of text above into a filter that's assigned `_` then reference that filter in all the other filters with `_:` like so:
Capture.PNG
Capture.PNG (60.88 KiB) Viewed 3580 times
bit
Posts: 31
Joined: Fri Feb 17, 2023 8:57 am

Re: Column Formulas

Post by bit »

void wrote: Mon Jan 02, 2023 9:04 am foo bar column1:=regexmatch($fullpath:,"^C:\\Users\\My User Name\\")?1:0 sort:column1-descending;dm
There is only "REGEX_MATCH" listed as functions.
Is this a special case, or, all other column functions can be used without underscore in their names?

ANd the "?" operator are not listed/explained in this post.
void
Developer
Posts: 13563
Joined: Fri Oct 16, 2009 11:31 pm

Re: Column Formulas

Post by void »

There is only "REGEX_MATCH" listed as functions.
Is this a special case, or, all other column functions can be used without underscore in their names?
The underscore (_) can be omitted in function names.
I'll leave them in the descriptions for readability.
I've added this note to the main post.


ANd the "?" operator are not listed/explained in this post.
Column Formulas support C style expressions.
This includes the ternary conditional operator.

Ternary conditional operator:
expression '?' true-value ':' false-value

if expression is true, the true-value is returned.
if expression is false, the false-value is returned.

For example:

len($name:)>5?"long name":"short name"

if length of the name is longer than 5, return "long name" else return "short name"
Post Reply