yields True if no substring in "string" matches the string expression patt, and yields False otherwise.


yields True if no substring matches any of the patti.


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


represents an operator form of StringFreeQ 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 StringFreeQ treat lowercase and uppercase letters as equivalent.
  • StringFreeQ[patt][expr] is equivalent to StringFreeQ[expr,patt].
  • StringFreeQ[BioSequence["type","seq"],patt] checks 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 StringFreeQ is circular, wraparound matches are possible.


open allclose all

Basic Examples  (3)

Test whether a string contains a substring matching the pattern:

Give a list of strings as input:

Use the operator form of StringFreeQ:

Use the operator form to select strings:

Scope  (10)

Use string patterns:

Use a regular expression:

Mix regular expressions and string patterns:

Use pattern matching for dates:

Test for occurrences of either pattern:

StringFreeQ automatically threads over lists of strings:

Check whether a biomolecular sequence is free of 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 the absence of literal degenerate letters using Verbatim:

Circular sequences support wraparound checks:

Options  (2)

IgnoreCase  (2)

Use IgnoreCase->True to check for the presence of substrings regardless of case:

The operator representation of a case-independent check:

Applications  (1)

Pick all the lines that contain a substring that matches the pattern:

Line numbers with corresponding texts that contain "noon" or "day of":

Properties & Relations  (8)

StringFreeQ threads over lists of strings in the first argument:

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

StringContainsQ["string",patt] is equivalent to !StringFreeQ["string",patt]:

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

StringFreeQ generally returns False when StringMatchQ is True:

Use StringStartsQ to check whether the start of a string matches a pattern:

StringFreeQ returns False whenever StringStartsQ is True:

Use StringEndsQ to check whether the end of a string matches a pattern:

StringFreeQ returns False whenever StringEndsQ is True:

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

Use StringCases to extract substrings matching a given pattern:

Wolfram Research (2004), StringFreeQ, Wolfram Language function, (updated 2020).


Wolfram Research (2004), StringFreeQ, Wolfram Language function, (updated 2020).


Wolfram Language. 2004. "StringFreeQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020.


Wolfram Language. (2004). StringFreeQ. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_stringfreeq, author="Wolfram Research", title="{StringFreeQ}", year="2020", howpublished="\url{}", note=[Accessed: 25-June-2024 ]}


@online{reference.wolfram_2024_stringfreeq, organization={Wolfram Research}, title={StringFreeQ}, year={2020}, url={}, note=[Accessed: 25-June-2024 ]}