Regular Expressions

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:

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