yields True if the beginning of "string" matches the string expression patt, and yields False otherwise.


yields True if the beginning of "string" matches any of the patti.


gives a list of the results for each of the "stringi".


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

Details and Options

  • The string expression patt can contain any of the objects specified in the notes for StringExpression.
  • Setting the option IgnoreCase->True makes StringStartsQ treat lowercase and uppercase letters as equivalent.
  • StringStartsQ[patt][expr] is equivalent to StringStartsQ[expr,patt].
  • StringStartsQ[BioSequence["type","seq"],patt] checks the start of 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.
  • StringStartsQ has no special behavior for circular biomolecular sequences, but instead interprets the start of the string as the designated start of the sequence.


open allclose all

Basic Examples  (4)

Check that a string starts with a given prefix:

Give a list of strings as input:

Specify a prefix using a string pattern:

Use the operator form of StringStartsQ:

Use the operator form to select strings:

Scope  (9)

Use string patterns:

Use a regular expression:

Mix regular expressions and string patterns:

Use pattern matching for dates:

Test for occurrences of either pattern:

StringStartsQ automatically threads over lists of strings:

Check whether a biomolecular sequence starts with a particular substring:

Use a wildcard in the pattern compared against a biomolecular sequence:

The "N" is a degenerate letter only in biomolecular sequences:

Check for literal degenerate letters using Verbatim:

Options  (2)

IgnoreCase  (2)

Use IgnoreCaseTrue to check for a leading string regardless of case:

The operator representation of a case-independent check:

Properties & Relations  (8)

StringStartsQ threads over lists of strings in the first argument:

StringStartsQ["string",{patt1,patt2,}] is equivalent to StringStartsQ["string",Alternatives[patt1,patt2,]]:

StringEndsQ checks whether a suffix matches a pattern:

StringStartsQ checks whether a prefix matches a pattern:

Use StringMatchQ to check whether a whole string matches a pattern:

StringStartsQ checks whether a prefix matches a pattern:

StringStartsQ returns True whenever StringMatchQ is True:

StringStartsQ["string",patt] is equivalent to StringMatchQ["string",StartOfString~~patt~~___]:

StringStartsQ["string",patt] is equivalent to StringContainsQ["string",StartOfString~~patt]:

Get the starting and ending positions where a prefix occurs by using StringPosition:

Use StringCases to extract prefixes matching a given pattern:

Wolfram Research (2015), StringStartsQ, Wolfram Language function, (updated 2020).


Wolfram Research (2015), StringStartsQ, Wolfram Language function, (updated 2020).


Wolfram Language. 2015. "StringStartsQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020.


Wolfram Language. (2015). StringStartsQ. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_stringstartsq, author="Wolfram Research", title="{StringStartsQ}", year="2020", howpublished="\url{}", note=[Accessed: 24-May-2024 ]}


@online{reference.wolfram_2024_stringstartsq, organization={Wolfram Research}, title={StringStartsQ}, year={2020}, url={}, note=[Accessed: 24-May-2024 ]}