Skip to content

Wildcard Masks

Description:
Many API methods accept wildcard masks for groups, symbols, and other string filters.
These masks use one shared matching model across the platform.

Supported Tokens

  • * matches any sequence of characters, including an empty sequence
  • ? matches exactly one arbitrary character
  • ! at the beginning of a token makes the token exclusionary
  • , separates multiple mask tokens inside one expression

Matching Rules

Mask expressions are evaluated with the following rules:

  1. Exclude masks have priority.
  2. Include masks work with OR semantics.
  3. If there are no include masks, everything is included unless excluded.

In practical form:

result = !matches_any(excludes) && (includes.empty() || matches_any(includes))

Examples

For the value GRP_FULL:

Mask Result Reason
* match matches everything
GRP_FULL match exact match
GRP_FU* match prefix match
*P_FULL match suffix match
*RP_FU* match substring match
GR?_FULL match ? matches one character (P)
GRP?FULL no match requires exactly one character between GRP and FULL
!GRP_FULL no match exact exclusion
!GRP_FU* no match excluded by prefix
!*P_FULL no match excluded by suffix
!*RP_FU* no match excluded by substring

Multiple Includes

Include masks are combined through OR.

VIP-*,DEMO-*,REAL-01

This matches any value that:

  • starts with VIP-
  • or starts with DEMO-
  • or exactly equals REAL-01

Includes With Excludes

Example:

REAL-*,!REAL-TEST*,!REAL-ARCHIVE

This means:

  • include all values starting with REAL-
  • but exclude everything starting with REAL-TEST
  • and exclude the exact value REAL-ARCHIVE

MT5-Style Single Character Matching

The ? token follows the usual MT5-style meaning:

  • EURUSD? matches EURUSDm
  • EURUSD? does not match EURUSD
  • ??-REAL matches IB-REAL
  • ??-REAL does not match VIP-REAL

Empty And Whitespace Handling

  • surrounding spaces around tokens are ignored
  • empty tokens between commas are ignored

Example:

  REAL-* , !REAL-TEST* , , VIP-??

This is treated the same as:

REAL-*,!REAL-TEST*,VIP-??

Typical Use Cases

  • group masks
  • symbol masks
  • report filters
  • server-side selection lists

Notes

  • matching is case-sensitive
  • * can match an empty sequence
  • ? always matches exactly one character