SetLabel Behaviour

Observations from experiments with SETLABEL. The screen grab below is for reference. WhiteOnRed is configured for Files Only and is not a regular expression.

[ol][li]The wildcard string includes an underscore after the word Test but when applied it matches files with just test (no underscore). It may be relevant that the parent folder is named Test_Shortcut. If I rename it to Test-Shortcut the files are no longer matched.[/li][li]If I change the definition from Files Only to Folders Only, all folders contained inside a matched folder are highlighted, whether or not the folder name matches the wildcard.[/li][li]If I edit the label definition and change from Test_ to TestX the change is made OK, and takes immediate effect when I click Apply, but does not show up correctly in the Prefs window until I exit and reopen Prefs.[/li][/ol]
Regards, AB


Wildcards apply to the whole file path.

If you only want "test_" in the filename part to be matched then use a wildcard such as *~(*)test_~(*)

~(*) means match any characters that are not backslashes.

I thought I'd give this a crack with Regex. I should have known better! It's not my forte and I always struggle. Here's my attempt to follow your suggestion, Leo. Per the screen grab, it doesn't do what I want, which is to apply the label only to the indicated file. Regex gurus are invited to point out where my hack has gone wrong.

Regards, AB


The following regex seems to works for me:

test_[^\]*$

It's the $ at the end that makes it work. Reg-exp often consider it a 'match' if any sub-string matches the expression. ^ and $ can be used to explicitly match the start and end of the string to ensure you match the whole thing (or you match a prefix or suffix).

Thanks to you both, moochew and leo. This is a very useful template for all sorts of labelling.

Regards, AB