> For the complete documentation index, see [llms.txt](https://swu-forge.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swu-forge.gitbook.io/docs/cards-and-search/searching-cards/scryfall-syntax.md).

# Scryfall Syntax Reference

Scryfall Syntax is a **prefix-style** search dialect modelled on [Scryfall](https://scryfall.com) and [SWUDB](https://swudb.com/syntax) — e.g. `c:r power>3 tr:jedi`. It's one of the two structured search dialects on SWU Forge; the other is [Forge Syntax](/docs/cards-and-search/searching-cards/search-syntax.md) (function-call style like `aspect(red) power(>3)`).

You don't have to pick a mode manually: the search box **auto-detects** which dialect you're typing. Typing `c:r` switches you to Scryfall; typing `aspect(red)` switches you to Forge. Your choice is remembered, and you can also set it explicitly from the search-mode dropdown or [Settings](/docs/account/settings.md).

Syntax is always taken **literally** — even with Plain Language Search turned on. `c:r` narrows results to cards with Aggression and nothing else; Forge never adds conditions you didn't type, such as ruling out the other five aspects. Only plain-language wording ("red cards") is open to interpretation.

## Recipes (quick start)

| Query                          | Finds                                                 |
| ------------------------------ | ----------------------------------------------------- |
| `c:r`                          | Cards with the Aggression aspect                      |
| `c:rk`                         | Cards with **both** Aggression and Villainy           |
| `c<=bk`                        | Cards playable in a Vigilance/Villainy deck (subset)  |
| `t:u power>3`                  | Units with power greater than 3                       |
| `hp>power`                     | Cards with more HP than power                         |
| `t:u power>=cost+2 hp>=cost+2` | Overstatted units — both stats at least 2 above cost  |
| `tr:jedi c:g`                  | Command (green) Jedi                                  |
| `kw:sentinel r<=3`             | Sentinel cards costing 3 or less                      |
| `t:u c:r or t:u c:b`           | Units that are red **or** blue                        |
| `(c:h or c:k) t:u`             | Units with a morality aspect (Heroism or Villainy)    |
| `a:"draw a card"`              | Cards whose text says "draw a card"                   |
| `a:defeat a:upgrade`           | Cards whose text mentions both "defeat" and "upgrade" |
| `cn:196`                       | The card printed as #196                              |

## How It Works

A query is a list of **terms** separated by spaces. Every term is a required condition (**AND**). A term is one of:

* **a filter** — `prefix` + operator + value, e.g. `c:r`, `p>3`, `tr:jedi`, `hp!=power`
* **free text** — a bare word searches card names, e.g. `luke t:u`
* **a quoted phrase** — `"..."` for multi-word values, e.g. `a:"have the initiative"`
* **`or`** — see [OR & parentheses](#or--parentheses)

### Operators

`:` `=` `!=` `<` `<=` `>` `>=`. For **aspects**, `:` means "includes" (has all listed); `=` is exact (see [Aspect operators](#aspect-operators)). For **numbers**, `:` is the same as `=` (exact). Text-ish fields treat `:` and `=` the same.

## Prefix Reference

| Prefix (aliases)           | Filters                                                                                                                                                                                                                                                                   | Example          |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| `c` `color` `aspect`       | Aspect (see below)                                                                                                                                                                                                                                                        | `c:rk`           |
| `tr` `trait` `traits`      | Trait (multiple = AND)                                                                                                                                                                                                                                                    | `tr:mandalorian` |
| `kw` `keyword`             | Keyword                                                                                                                                                                                                                                                                   | `kw:ambush`      |
| `a` `ability`              | Card ability text (`a!=` excludes)                                                                                                                                                                                                                                        | `a:heal`         |
| `t` `type`                 | Type — `l` b `u` e `a` (leader/base/unit/event/upgrade), or `token`                                                                                                                                                                                                       | `t:u`            |
| `arena` `l` `lane`         | Arena — `s`/`space`, `g`/`ground`                                                                                                                                                                                                                                         | `arena:g`        |
| `r` `cost` `resources`     | Resource cost                                                                                                                                                                                                                                                             | `r>=4`           |
| `power`                    | Power (also matches an upgrade/pilot's granted power; values can be negative)                                                                                                                                                                                             | `power=-2`       |
| `hp`                       | HP (also matches an upgrade/pilot's granted HP; values can be negative)                                                                                                                                                                                                   | `hp<0`           |
| `powerbonus` `hpbonus`     | Upgrade/pilot power or HP bonus                                                                                                                                                                                                                                           | `powerbonus>=2`  |
| `pc` `pilotingcost`        | Piloting cost                                                                                                                                                                                                                                                             | `pc<=1`          |
| `cn` `cardnumber` `number` | Card number                                                                                                                                                                                                                                                               | `cn:196`         |
| `set`                      | Set (code or name; `set!=` excludes a set)                                                                                                                                                                                                                                | `set:sor`        |
| `rarity`                   | Rarity — `c` u `r` l `s` or full name                                                                                                                                                                                                                                     | `rarity:l`       |
| `ti` `title`               | Card title                                                                                                                                                                                                                                                                | `title:mentor`   |
| `tistart`                  | Card title **starts with**                                                                                                                                                                                                                                                | `tistart:the`    |
| `doubled`                  | Aspect printed twice on the card                                                                                                                                                                                                                                          | `doubled:b`      |
| `rotation`                 | Rotation block — `a` or `b`                                                                                                                                                                                                                                               | `rotation:b`     |
| `u` `unique`               | Uniqueness — `u:t` / `u:f`                                                                                                                                                                                                                                                | `u:t`            |
| `vanilla`                  | No ability text                                                                                                                                                                                                                                                           | `vanilla:t`      |
| `is:` `isnot:`             | Sugar — a card type (`is:leader` `is:base` `is:unit` `is:event` `is:upgrade`), `is:token`, `is:vanilla`, `is:unique`, a rarity (`is:common` `is:uncommon` `is:rare` `is:legendary` `is:special`), a variant (`is:prestige` `is:showcase`), or ban status (`is:suspended`) | `is:leader`      |
| `legal:`                   | `legal:premier` (Premier-legal)                                                                                                                                                                                                                                           | `legal:p`        |

Numeric fields (`cost`, `power`, `hp`) also accept **another stat name** as the value for a cross-field comparison: `cost<power`, `hp!=power`. The value can also be **stat math**: whole numbers and stat names joined with `+`, `-`, and `*` — `hp>cost+2`, `power>=2*cost`, or `power>=2*cost-hp` (power plus HP at least double the cost). `r` works as a name for cost here, so `power>r+1` also works. Write the math without spaces, or with spaces around the `+`/`*` — `hp>cost + 2` reads the same. Parentheses aren't supported, and you can't multiply two stats together. `power` and `hp` accept negative values and also match the bonus an Upgrade or Pilot grants — `t:a power=-2` finds upgrades that give -2 power.

Repeating an exact value on the same stat means **or**, since no card can be two costs at once: `r:2 r:3` finds 2- and 3-cost cards, and `power:3 power:5` finds cards with 3 or 5 power. Comparisons still stack as **and**, so `power>=3 power<=5` is the range 3–5.

### Traits name the planet a base is on

Every base has a trait for its location, so you can search by world instead of by card name — `Echo Base` is the title, `Hoth` is the trait:

* `tr:hoth` — everything from Hoth
* `tr:coruscant t:b` — bases on Coruscant
* `tr:"cloud city"` — multi-word locations need quotes

Aside from Naboo, which also appears on characters and ships, these names turn up on bases only.

## Aspects

Refer to aspects by **colour letter**, name, or abbreviation:

| Aspect     | Letter       | Name / abbrev      |
| ---------- | ------------ | ------------------ |
| Aggression | `r` (red)    | `aggression`, `a`  |
| Command    | `g` (green)  | `command`, `co`    |
| Cunning    | `y` (yellow) | `cunning`, `cu`    |
| Heroism    | `w` (white)  | `heroism`, `h`     |
| Vigilance  | `b` (blue)   | `vigilance`, `vig` |
| Villainy   | `k` (black)  | `villainy`, `vil`  |

Combine **single colour letters** in one value: `c:rk` = Aggression + Villainy. (Names/abbreviations are one aspect at a time.)

### Aspect operators

| Operator    | Meaning                                                             | Example |
| ----------- | ------------------------------------------------------------------- | ------- |
| `:` or `>=` | Has **all** listed aspects (may have more)                          | `c:rk`  |
| `=`         | **Exactly** these aspects, no more, no fewer                        | `c=rk`  |
| `<=`        | **Subset** — only these aspects (colourless allowed); "playable in" | `c<=bk` |
| `<`         | Strictly fewer than the listed aspects                              | `c<rk`  |
| `>`         | Has all listed **plus at least one more**                           | `c>r`   |
| `!=`        | Does **not** have the listed aspects                                | `c!=k`  |

## OR & parentheses

By default terms combine with AND. Use **`or`** to match either side, and **parentheses** to group:

* `power>2 or hp>2` — power over 2, or HP over 2
* `c:a or c:vil r<=2` — Aggression, or Villainy costing 2 or less
* `(c:h or c:k) t:u` — Units with a morality aspect

Parentheses and `or` don't nest (matching SWUDB).

You can also write **`and`** between terms if it reads better next to an `or` — `c<=byg and (tr:underworld or tr:fringe)` finds exactly the same cards as leaving it out.

## Searching card text for several words

Each `a:` term is its own search, and every one has to match somewhere in the card's text — the words don't need to be next to each other:

* `a:defeat and a:upgrade` — mentions both "defeat" and "upgrade", so it finds R5-D4's "Defeat all upgrades" as well as "Defeat an upgrade"
* `a:defeat or a:return` — mentions either word
* `a:defeat a!=non-leader` — mentions "defeat" but not "non-leader"

To find words **side by side**, quote them as one phrase instead: `a:"defeat an upgrade"`.

## Quotation marks

Wrap multi-word values in quotes: `a:"have the initiative"`, `title:"Aspiring to Authority"`.

That includes the words `and` and `or` themselves: quoted, they're searched for as text rather than read as connectors, so `c:r "and" t:u` looks for red units with "and" in their name or rules text.

An apostrophe inside a word is just part of the word, so single-word names that contain one need no quotes: `tr:Twi'lek set:HMW` finds the Twi'lek cards in Homeworlds.

## Don't mix the two styles

This prefix style and the Forge style (`aspect(green)`, `hp(>=3)`) can't be combined in one query. If you drop a Forge filter into a prefix query, it won't be applied — you'll get an error telling you the term won't work and pointing you to the prefix form (e.g. use `c:g`, not `aspect(green)`).
