Skip to contents

You can use forward slashes // instead of quotes with the type://, t:// 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 Regex Flavor

Scryfall supports most POSIX regular expression constructs, many are detailed below. Our regular expressions have the following configuration and limits:

  • If your expression includes forward slashes / they must be escaped: \\/
  • Scryfall regular expressions are Unicode-aware. The . will match characters beyond the ASCII range.
  • Backreferences are not supported (\\1, \\2, etc).
  • All regular expressions are case-insensitive (i).
  • All regular expressions are “multiline” mode (m). Line anchors will match paragraphs in Oracle text, instead of the entire block.
  • All characters in your expression are significant and whitespace will be matched (sometimes listed as “tight mode”).
  • You cannot add configuration to regular expressions on Scryfall. For example o:/tap/ will work while o:/tap/gi will not.
  • Scryfall regular expressions are match-only. Scryfall does not support extracting data from capture groups or performing substitutions.
  • Scryfall uses only the \n character for newlines in all text fields across our entire database. No fields include \r or \f.
  • The Scryfall database does not include bells (\a), null-bytes (\0), or other esoteric control characters.

Scryfall Extensions

Scryfall includes the following additional, non-standard regex features:

Syntax Feature
~ An automatic alias for the current card name or “this spell” if the card mentions itself
\\sm Short-hand escape for any mana symbol
\\ss Short-hand escape for any card symbol
\\spt Short-hand escape for a X/X power/toughness expression
\\spp Short-hand escape for a +X/+X power/toughness expression
\\smm Short-hand escape for a -X/-X power/toughness expression

Atoms

The following atoms are supported:

Atom Description
. Any single character
[kf] Bracket expression matching a single character which is k or f (or any other group of literal characters)
[^kf] Bracket expression matching a single character which is not k or f (or any other group of literal characters)
[f-k] Bracket expression matching a single character which is between f through k in Unicode, inclusive (or any other range of of literal characters)
(re) A group that matches the expression re
(re|fe) A group that matches either the expression re or fe. | is the pipe character
\\k A literal escaped k (or any other character)
k The character k (or another non-meta character)

Quantifiers

The following quantifiers are supported:

Quantifier Description
* A sequence of 0 or more matches of the atom
+ A sequence of 1 or more matches of the atom
? A sequence of 0 or 1 matches of the atom
{M} A sequence of exactly M matches of the atom, where M is a number
{M,} A sequence of M or more matches of the atom
{M,N} A sequence of M through N (inclusive) matches of the atom; M cannot exceed N
*? Non-greedy version of *
+? Non-greedy version of +
?? Non-greedy version of ?
{M}? Non-greedy version of {M}
{M,}? Non-greedy version of {M,}
{M,N}? Non-greedy version of {M,N}

Anchors and Lookarounds

The following anchors/lookarounds are supported:

Anchor Description
^ Matches at the beginning of a line or the beginning of the field
$ Matches at the end of a line or the end of the field
\\b Matches the boundary of a word
(?=re) Positive lookahead: matches at any point where a substring matching re begins
(?!re) Negative lookahead: matches at any point where no substring matching re begins
(?<=re) Positive lookbehind: matches at any point where a substring matching re ends
(?<!re) Negative lookbehind: matches at any point where no substring matching re ends

Character Classes

The following character classes are supported:

Class Description
\\n Matches a newline
\\s Matches any whitespace
\\d Matches a single digit character: 0-9
\\w Matches any word character: A through z and 0 through 9
\\uHHHH Matches a character whose hexadecimal value is HHHH, where HHHH is exactly four hexadecimal digits