FWIW, your excel formula converted to Everything:
Code: Select all
addcol:A A:=MID($full-path:,FIND("\",$full-path:,5)+1,1)":\"MID($full-path:,FIND("\",$full-path:,FIND("\",$full-path:,5)+1)+1,LEN($full-path:)-FIND("\",$full-path:,FIND("\",$full-path:,5)+1)-8)
Something to keep in mind: Formulas don't support spaces currently.
Works: eval(1+1). Doesn't: eval(1 + 1). Does work: eval("1 + 1").
I would go with a regex approach too, but a regex-free alternative:
- Use the element() formula and use "\" as the element separator
- Get the third element ("j") of the path (not full filename; explained later) (1)
- Get the position of the 3rd "\" of the path (not full filename; explained later)
- Get the path from that position until the end (2)
- From the filename, get the stem (=name without extension).
- From the remaining, get the stem (3)
- Output = (1) + ":" + (2) + "\" + (3)
The Everything formula turned out to be a bit more complex than I anticipated, but still somewhat readable:
Code: Select all
addcol:A A:=element($path:,"\",3):substr($path:,find("|",substitute($path:,"\","|",3)))\stem($stem:)
dedupeit wrote: Tue Jan 07, 2025 4:52 pm
I'm sure there are better ways to do this but this works
Code: Select all
add-column:a a:=stuff(regexextract(fullpath:,".*?\\.*?\\(.*).{8}"),2,0,":")
I'm not so sure

BTW: stuff() ... completely forgot about its existence. Thanks for the refresher!