tests whether "string" matches the string pattern patt.


tests whether "string" matches the specified regular expression.


gives the list of results for each of the si.


represents an operator form of StringMatchQ that can be applied to an expression.

Details and Options

  • StringMatchQ allows both ordinary StringExpression string patterns, as well as abbreviated string patterns containing the following metacharacters:
  • *zero or more characters
    @one or more characters, excluding uppercase letters
    \\*, etc.literal *, etc.
  • Verbatim["p"] specifies the verbatim string "p", with * and @ treated literally.
  • Setting the option IgnoreCase->True makes StringMatchQ treat lowercase and uppercase letters as equivalent.
  • Setting the option SpellingCorrection->True makes StringMatchQ allow strings to match even if a small fraction of their characters are different.
  • StringMatchQ[form][expr] is equivalent to StringMatchQ[expr,form].
  • StringMatchQ[BioSequence["type","seq"],patt] will match the string "seq" against patt. In this case, degenerate letters in patt are interpreted as wildcard patterns based on the type of biomolecular sequence. Use Verbatim["patt"] to match degenerate letters literally.
  • The documentation for BioSequence lists the degenerate letters supported by each type of biomolecular sequence.
  • If the biomolecular sequence operated upon by StringMatchQ is circular, wraparound matches are possible.


open allclose all

Basic Examples  (3)

Test whether a string pattern matches a particular string:

Use abbreviated string patterns:

Use the operator form of StringMatchQ:

Scope  (9)

Use string patterns:

Use a regular expression:

Use pattern matching for dates:

Mixed regular expressions and string patterns:

StringMatchQ automatically threads over lists of strings:

Find whether a biomolecular sequence will match a given pattern:

Find whether a biomolecular sequence matches a degenerate pattern:

Circular sequences support wraparound matches:

Use Verbatim to avoid a degenerate match:

Options  (2)

IgnoreCase  (1)

With IgnoreCase -> True, uppercase and lowercase are treated the same:

SpellingCorrection  (1)

The option SpellingCorrection -> True allows automatic spelling correction:

Applications  (1)

Find all words that contain double letters:

Properties & Relations  (3)

For literal strings, SameQ is equivalent to StringMatchQ:

For fast extraction of elements in a list, use Pick:

Compare to Select:

Use StringFreeQ to check no substring matches a pattern:

StringMatchQ returns False whenever StringFreeQ is True:

Possible Issues  (2)

StringMatchQ does not work on strings with embedded formatting information:

Spelling correction only works for letter string patterns:

Wolfram Research (1988), StringMatchQ, Wolfram Language function, (updated 2020).


Wolfram Research (1988), StringMatchQ, Wolfram Language function, (updated 2020).


Wolfram Language. 1988. "StringMatchQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020.


Wolfram Language. (1988). StringMatchQ. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2022_stringmatchq, author="Wolfram Research", title="{StringMatchQ}", year="2020", howpublished="\url{}", note=[Accessed: 26-November-2022 ]}


@online{reference.wolfram_2022_stringmatchq, organization={Wolfram Research}, title={StringMatchQ}, year={2020}, url={}, note=[Accessed: 26-November-2022 ]}