# SetLabel Behaviour

**URL:** <https://resource.dopus.com/t/setlabel-behaviour/10846>\
**Category:** Help & Support\
**Created:** [May 12, 2011, 1:02am UTC](https://resource.dopus.com/t/setlabel-behaviour/10846 "2011-05-12T01:02:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aussieboykie](https://resource.dopus.com/user_avatar/resource.dopus.com/aussieboykie/32/23729_2.png) [@aussieboykie](https://resource.dopus.com/u/aussieboykie)\
**Post date:** [May 12, 2011, 1:02am UTC](https://resource.dopus.com/t/setlabel-behaviour/10846/1 "2011-05-12T01:02:27Z")

</div>

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

 ![](https://resource.dopus.com/uploads/default/original/3X/4/2/426bd21d2febcf4da0e1cb8a73a85232d3841544.jpg)

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [May 12, 2011, 7:15am UTC](https://resource.dopus.com/t/setlabel-behaviour/10846/2 "2011-05-12T07:15:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aussieboykie](https://resource.dopus.com/user_avatar/resource.dopus.com/aussieboykie/32/23729_2.png) [@aussieboykie](https://resource.dopus.com/u/aussieboykie)\
**Post date:** [May 13, 2011, 1:03am UTC](https://resource.dopus.com/t/setlabel-behaviour/10846/3 "2011-05-13T01:03:53Z")

</div>

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

![](https://resource.dopus.com/uploads/default/original/3X/5/6/5627dd66f851c9188954a0c0bceb5fb0024aab89.jpg)

---

<div class="post-metadata">

**Author:** ![moochew](https://resource.dopus.com/letter_avatar_proxy/v4/letter/m/3be4f8/32.png) [@moochew](https://resource.dopus.com/u/moochew)\
**Post date:** [May 13, 2011, 3:37am UTC](https://resource.dopus.com/t/setlabel-behaviour/10846/4 "2011-05-13T03:37:45Z")

</div>

The following regex seems to works for me:

test\_[^\]\*$

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [May 13, 2011, 6:32am UTC](https://resource.dopus.com/t/setlabel-behaviour/10846/5 "2011-05-13T06:32:34Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![aussieboykie](https://resource.dopus.com/user_avatar/resource.dopus.com/aussieboykie/32/23729_2.png) [@aussieboykie](https://resource.dopus.com/u/aussieboykie)\
**Post date:** [May 13, 2011, 6:51am UTC](https://resource.dopus.com/t/setlabel-behaviour/10846/6 "2011-05-13T06:51:38Z")

</div>

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

Regards, AB
