StringMatchQ
StringMatchQ["string",patt]
tests whether "string" matches the string pattern patt.
StringMatchQ["string",RegularExpression["regex"]]
tests whether "string" matches the specified regular expression.
StringMatchQ[{s1,s2,…},p]
gives the list of results for each of the si.
StringMatchQ[patt]
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.
Examples
open allclose allBasic Examples (3)
Test whether a string pattern matches a particular string:
Use abbreviated string patterns:
Use the operator form of StringMatchQ:
Scope (9)
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:
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:

Text
Wolfram Research (1988), StringMatchQ, Wolfram Language function, https://reference.wolfram.com/language/ref/StringMatchQ.html (updated 2020).
CMS
Wolfram Language. 1988. "StringMatchQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/StringMatchQ.html.
APA
Wolfram Language. (1988). StringMatchQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/StringMatchQ.html