StringMatchQ["string", patt]
tests whether matches the string pattern patt.

StringMatchQ["string", RegularExpression["regex"]]
tests whether matches the specified regular expression.

StringMatchQ[{s1, s2, ...}, p]
gives the list of results for each of the .

Details and OptionsDetails 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 , 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.
New in 1 | Last modified in 5.1
New to Mathematica? Find your learning path »
Have a question? Ask support »