Skip to main content

Expression Editor

The expression editor is how you write filter and mapping rules.

Basic Syntax

Expressions compare fields to values:

field operator "value"

Examples:

channel_name equals "News Channel"
group_title contains "Sports"
tvg_id starts_with "sports."

Operators

String Comparison

OperatorDescriptionExample
equalsExact matchchannel_name equals "News Channel"
containsSubstring matchchannel_name contains "News"
starts_withPrefix matchchannel_name starts_with "Sports"
ends_withSuffix matchchannel_name ends_with "HD"
matchesRegex matchchannel_name matches "Sports.*HD"

Negated Operators

OperatorDescription
not_equalsNot exact match
not_containsDoesn't contain
not_starts_withDoesn't start with
not_ends_withDoesn't end with
not_matchesRegex doesn't match

Numeric Comparison

OperatorDescription
greater_thanValue greater than number
less_thanValue less than number
greater_than_or_equalValue greater than or equal
less_than_or_equalValue less than or equal

Symbolic Aliases

You can also use familiar symbols:

SymbolEquivalent
==equals
!=not_equals
=~matches
!~not_matches
>greater_than
<less_than
>=greater_than_or_equal
<=less_than_or_equal

Combining Conditions

Use AND, OR, and parentheses:

channel_name contains "News" AND group_title equals "News"

(channel_name contains "Sports" OR channel_name contains "Movies") AND group_title not_equals "Radio"

NOT channel_name contains "Adult"

Available Fields

Stream/Channel Fields

FieldDescription
channel_nameDisplay name
tvg_idEPG identifier
tvg_nameAlternative name
tvg_logoLogo URL
group_titleCategory/group
stream_urlStream URL
channel_numberAssigned number
source_nameSource it came from (read-only)

EPG/Programme Fields

FieldDescription
programme_titleShow title
programme_descriptionShow description
programme_categoryShow category

Request Fields (Client Detection)

FieldDescription
client_ipClient's IP address
request_pathURL path
hostHost header
@dynamic(request.headers):nameAny request header
@dynamic(request.query):nameAny query parameter

SET Actions (Data Mapping Only)

Data mapping rules can modify fields:

condition SET field = "value"

SET Action Types

ActionDescriptionExample
SETSet field valueSET group_title = "Sports"
SET_IF_EMPTYSet only if emptySET_IF_EMPTY tvg_id = "unknown"
APPENDAdd to valueAPPEND channel_name = " HD"
REMOVERemove substringREMOVE channel_name = "HD"

Value Sources

SyntaxDescription
"literal"Literal string
$fieldCopy from another field
$1, $2Regex capture groups
@dynamic(...)Dynamic request value
@time:nowCurrent timestamp
@logo:ULIDCached logo reference

Examples

Filter: UK Sports Only

group_title equals "Sports" AND source_name equals "UK Provider"

Mapping: Clean Channel Names

channel_name matches "^(.+) (HD|SD|FHD)$" SET tvg_name = "$1", quality = "$2"

Mapping: Fix Logos

channel_name contains "Sports" SET tvg_logo = "https://example.com/sports-logo.png"

Client Detection: Mobile Gets Lower Quality

@dynamic(request.headers):user-agent contains "Android" SET preferred_profile = "mobile-720p"