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 the list of results for each of the si.


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] will check 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 pattern contains a substring matching the pattern:

Check that a string is free of "a":

Use the operator form of StringFreeQ:

Scope  (10)

Use string patterns:

Use a regular expression:

Pattern matching for dates:

Mixed regular expressions and string patterns:

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:

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  (3)

StringMatchQ checks whether a whole string matches a pattern:

StringFreeQ checks whether a substring matches a pattern:

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_2022_stringfreeq, author="Wolfram Research", title="{StringFreeQ}", year="2020", howpublished="\url{}", note=[Accessed: 25-September-2022 ]}


@online{reference.wolfram_2022_stringfreeq, organization={Wolfram Research}, title={StringFreeQ}, year={2020}, url={}, note=[Accessed: 25-September-2022 ]}