Say I want to sort found files by a string contained somewhere in the filename, for example, and underscore followed by four digits, no matter where in the filename it occurs.
This works: "regex:name:_\d\d\d\d sort:regmatch0"
I thought I had it working also with "sort:name:regex:_\d\d\d\d" but later I discovered it wasn't working. Is there some variation on this that would work? But of course using "sort:regmatch0" is certainly easy enough.
sorting by string embedded in a property value (e.g. name)
Re: sorting by string embedded in a property value (e.g. name)
Don't think there is.
In case you need to do something further down the line with these numbers, this should work too:
This way the () capture group is the only thing shown in the regmatch1 column, consisting of just the four numbers, which makes it right aligned.
regmatch0 includes the underscore, which makes the match be considered text.
(the addcolumn:regmatch1 is not strictly needed, but helpful in giving feedback)
In case you need to do something further down the line with these numbers, this should work too:
Code: Select all
regex:"name:_(\d\d\d\d)" addcolumn:regmatch1 sort:regmatch1
regmatch0 includes the underscore, which makes the match be considered text.
(the addcolumn:regmatch1 is not strictly needed, but helpful in giving feedback)