Targeting Features
Targeting lets you control which users see which variants based on user attributes. You can target by any attribute you pass from your application — user role, subscription tier, region, signup date, and more.
How Targeting Works
When evaluating a feature, you pass a user object containing a unique ID and any attributes. Featureflow evaluates rules from top to bottom and returns the variant for the first matching rule.
The Failover Rule
Every feature has a failover rule — the catch-all "else" rule at the bottom. If no other rules match, users receive the variant defined in this rule.

Creating Rules
- Click Add Rule — a new rule panel appears above the failover rule
- Select a target attribute (e.g.,
tier,user_role,country) - Choose a comparator — options vary by data type (text, number, or date)
- Enter the value(s) to match against
- Select the variant or split to return when the rule matches
- Click Save Targeting
Comparators
The comparators offered depend on the attribute's data type. Values are compared strictly by type — a text comparator never matches a number, and a number comparator never matches text, so make sure the attribute your application sends has the type you expect.
Text
| Comparator | Matches when the attribute… |
|---|---|
equals | is exactly this value |
contains | contains this value anywhere |
startsWith | begins with this value |
endsWith | ends with this value |
matches | matches a regular expression — see below |
in | equals any of the listed values |
notIn | equals none of the listed values |
Number
| Comparator | Matches when the attribute… |
|---|---|
greaterThan / greaterThanOrEqual | is greater than (or equal to) this number |
lessThan / lessThanOrEqual | is less than (or equal to) this number |
Date
| Comparator | Matches when the attribute… |
|---|---|
before / after | is before / after this date-time |
Dates are compared as ISO-8601 date-times, with or without a timezone offset. A date-only value such as 2026-07-03 means midnight UTC, so a rule scheduled this way takes effect at the same instant for every user worldwide.
in and notIn accept a list of values; every other comparator takes a single value.
Matching with regular expressions
The matches comparator tests the attribute against a regular expression:
- It matches anywhere in the value. The pattern
adminmatchessuperadmin. To match the whole value, anchor the pattern with^and$. - Matching is case-sensitive and there are no flags. To match regardless of case, spell out both cases:
[Bb]eta.
Some useful patterns:
@example\.com$— email addresses on a domain^(alpha|beta)$— exactly one of several values^\d+$— digits only^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$— a UUID
Portable patterns
Targeting rules are evaluated inside your application by the Featureflow SDK, using your platform's own regular-expression engine. Those engines don't all support the same syntax, so Featureflow accepts the portable subset that behaves identically on every platform — guaranteeing a rule gives the same answer whether it runs in a browser, a JVM, a Go service, or a mobile app.
Supported: literal text, ., anchors (^, $, \b, \B), character classes like [a-z0-9] and [^…], the class shorthands \d \D \s \S \w \W, escapes \n \r \t \f and \xHH, groups (…) and (?:…), alternation with |, and the quantifiers *, +, ? and {n}, {n,}, {n,m} (up to 1000 repeats, with lazy ? variants).
Not supported: lookahead and lookbehind, backreferences, named groups, inline flags such as (?i), and escapes like \u, \p or \v that platforms interpret differently. Literal braces and brackets must be escaped: \{, \[. If a pattern uses unsupported syntax, the rule editor tells you as you type — and explains the portable way to write the same thing.
One subtlety worth knowing: on a few platforms \d, \w and \s can also match non-ASCII digits and letters. If you need strictly ASCII matching, use explicit classes such as [0-9] or [A-Za-z0-9_].
Multiple Conditions
Use the + and - buttons to add multiple conditions to a rule. All conditions within a rule are evaluated with AND logic — all must match for the variant to be returned.
Rule Order
Rules are evaluated top to bottom. The first matching rule wins. Drag rules to reorder them.

Reusing Conditions with Audiences
If you find yourself repeating the same conditions across features, save them as a named audience and select it in the rule's Match users by dropdown instead of defining the conditions inline.
Passing User Attributes
To use targeting, pass user attributes when evaluating features in your application:
var user = {
id: 'user-123',
attributes: {
name: 'john',
tier: 'gold',
user_role: 'pvt_tester'
}
}
FeatureFlowUser user = new FeatureflowUser(userId)
.withAttribute("user_role", "pvt_tester")
.withAttribute("tier", "gold")
.withAttribute("tenure_years", 10)
.withAttribute("signup_date", new DateTime());
The attributes you pass become available as targeting options in the dashboard.