Defining Target Groups

Feature Flags

Target groups let you define groups of users based on user priorities or device attributes. CloudBees Feature Flags includes built-in targeting using the format of rox.<attribute name>.

  • The main screen of the Target Group tab gives an overview of all the target groups, at which environment they are being used and how many experiments are using that specific target group

  • The right column shows the last change to the specific target group.

  • From this screen you can Archive a target group which is no longer being used, to do so click on the Archive button on right side of each Target Group.

  • All Users is a default target group that cannot be editing or removed.

Create a new Target Group

  • Go to the Target Groups tab from the left navigation menu.

  • Click on the New Target Group button on the top right side.

  • Give the Target Group a Name and a Description, also select the attribute on which you would like to segment via the drop-down menu.

  • Select the operator for the relevant drop-down menu.

  • Please note each attribute (depending on its type - String, Int, etc) would have different operators respectively.

  • Add the value to the input field.

Table 1. Built-in attributes
Attribute Name Notes


Two letter language code, e.g., "en," "es," or "fr"


OS name, e.g., "iOS" or "Android"


Screen height in pixels


Screen width in pixels

Editing a Target Group

  • Click on the Target Group you would like to edit.

  • Update the target group accordingly and click on the Update Group or Cancel respectively.

  • When a Target Group is being used by an Experiment the edit screen would become read-only.


  • Clicking on View Experiments will show all running Experiments that are using this target group. (You will also be able to see in which Environment the Experiment is active.)

Experiments using target groups

Editing a live Production Target Group

You can still edit a Target Group even if it’s already being used in a running Experiment, to do so click on the Enable Edit Anyway. Keep in mind you are changing the Production Environment

Edit live target group

Custom Properties can be used to define segments of users. Once a custom property has been created, you can use it when creating target groups:

Custom Properties in the Conditions Pulldown


Please note the following:

  1. Custom properties can be static or defined in code using CloudBees Feature Flags custom computed properties.

  2. In the client side SDKs, if the value of a custom property changes while the app is running—for example, after a user logs in you may need to use Rox.unfreeze(), (read more on flag update flow - Flag update flow).

Regex Syntax

You can run regex matching for custom properties from type String. Imagine the following example Target Group:


It is easiest to describe the underlying code behind the scene running on the SDK in the following scenario:

JavaScript C# Java Go Ruby Python PHP C C++
function regexMatch(str, pattern) {
    var regex = new RegExp(pattern, "");
    var match = regex.exec(str);
    return match ? true : false;
bool regexMatch(String str, String pattern){
   RegexOptions options = 0;
   Match match = Regex.Match(str, pattern, options);
   return match.Success;
boolean regexMatch(String str, String pattern){
   int options = 0;
   Pattern r = Pattern.compile(pattern, options);
   Matcher m = r.matcher(str);
   return m.find()
import (
boolean regexMatch(String str, String pattern){
  matched, _ := regexp.MatchString(pattern, str)
  return matched;
# In the above Example
#    str is the email property value
#    pattern is "@cloudbees\.com$"
matched = !, 0).match(src).nil?
import re

# In the above Example
#    str is the email property value
#    pattern is "@cloudbees\.com$", src, 0)
preg_match(pattern, src);

You can also check out part of our testing suite to understand the examples:

expect(parser.evaluateExpression('match("111", "222"')).toEqual(false);
expect(parser.evaluateExpression('match("22222", ".*")')).toEqual(true);
expect(parser.evaluateExpression('match("22222", "^2*$")')).toEqual(true);
expect(parser.evaluateExpression('match("[email protected]", ".*(com|ca)")')).toEqual(true);
expect(parser.evaluateExpression('match("[email protected]", ".*car\\.com$")')).toEqual(true);
expect(parser.evaluateExpression('match("US", ".*IL|US")')).toEqual(true);
expect(parser.evaluateExpression('match("US", "IL|US")')).toEqual(true);
expect(parser.evaluateExpression('match("US", "(IL|US)")')).toEqual(true);