Regular Expressions

You can use forward slashes // instead of quotes with the oracle:, o:, flavor:, ft:, and name: keywords to match those parts of a card using regular expressions.

Regular expressions are very powerful, here are some examples of fancy searches you can make with regular expressions:

Scryfall Syntax

Scryfall does not support all possible POSIX regular expression constructs, only the limited set detailed on this page is available.

  • All regular expressions are case-insensitive.
  • If your expression includes forward slashes / they must be escaped: \/
  • No other part of your expression needs to be escaped.

Wildcards

  • * — Matches any set of characters (equivalent to .*? in other systems)
  • ~ — Shorthand for the card name, similar to the Oracle text keyword.

Option groups

Option groups (a|b|c) are supported to match alternate words or phrases. For example, o:/(add|prevent)/ matches add or prevent anywhere in the Oracle text.

Quantifiers

  • ? — Matches zero or one of the preceding character or group

Character Classes

  • \n — Matches a newline
  • \d — Matches single digit character: 0–9
  • \d+ — Matches one or more digit characters: 0–9
  • \w — Matches a word character: A–z, 0–9 and the hyphen -
  • \w+ — Matches one or more word characters: A–z, 0–9 and the hyphen -

Please note that the plus sign + is treated as a regular plus sign in all other scenarios.

Anchors

  • \b — Word boundary. The start or end of a word.
  • ^ — Start-of-line anchor. Matches the start of a line/paragraph in the Oracle text.
  • $ — End-of-line boundary. Matches the end of a line/paragraph in the Oracle text.

Our regular expressions are “multiline mode”. Anchors match paragraphs in the Oracle text, instead of the entire block.

Negative Lookaheads

Negative lookaheads (?!) match something that isn’t followed by the phrase inside the lookahead. For example o:/eldrazi (?!scion)/ matches Oracle text with the word “eldrazi” that isn’t followed by the word “scion”.