Represents a best-effort structural decomposition of a Scryfall collector number.

Collector numbers are identifiers, not guaranteed ordinals. Their format varies widely across sets, promos, reprints, and special releases (IE variant suffixes, hyphenated set-qualified identifiers such as "CN2-22", symbolic forms, etc.).

This structure exposes optional numeric tokens and simple flags that may be used for sorting, grouping, or display heuristics. No semantic meaning such as release order or canonical numbering is implied or guaranteed.

All extracted fields are advisory and should be treated as heuristics only.

interface ParsedCollectorNumber {
    hasLeadingNumber: boolean;
    hasTrailingNumber: boolean;
    leadingNumber?: number;
    middle?: string;
    raw: string;
    trailingNumber?: number;
}
Index

Properties

hasLeadingNumber: boolean

Indicates whether the collector number begins with a numeric sequence.

hasTrailingNumber: boolean

Indicates whether the collector number ends with a numeric sequence.

leadingNumber?: number

A contiguous sequence of digits at the start of the collector number, if present.

Examples:

  • "123a" → 123
  • "10★" → 10
  • "CN2-22" → undefined
middle?: string

The substring between the leading and trailing numeric components, if any.

This may include set codes, separators, variant symbols, or other non-numeric identifiers and carries no assumed semantics.

Examples:

  • "CN2-22" → "CN2-"
  • "123a" → "a"
raw: string

The original collector number string exactly as provided by Scryfall. This value is always preserved and should be used as the authoritative identifier.

trailingNumber?: number

A contiguous sequence of digits at the end of the collector number, if present.

Examples:

  • "CN2-22" → 22
  • "PLIST-001" → 1
  • "123a" → undefined