StringFreeQ

StringFreeQ["string",patt]

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

StringFreeQ["string",{patt1,patt2,}]

yields True if no substring matches any of the patti.

StringFreeQ[{s1,s2,},p]

gives the list of results for each of the si.

StringFreeQ[patt]

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

Details and Options

Examples

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

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:

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:

Introduced in 2004
 (5.1)
 |
Updated in 2016
 (10.4)