This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
String Patterns
Mathematica's symbolic string patterns provide a compact yet readable basis for sophisticated string operations. Included directly in programs, or symbolically generated on the fly, Mathematica's string patterns can routinely be used on strings with millions of elements.
StringExpression a symbolic string-pattern expression (s~~s~~s)
_ any character
__, ___ sequences of characters (one or more, zero or more)
p|p|p alternatives
p.., p... repeated patterns
x_, x:p named patterns
Shortest, Longest shortest, longest matches
Except matches that exclude a pattern
RegularExpression string patterns in regular expression notation
IgnoreCase option for whether to ignore case
Overlaps option for how to treat substring overlaps
StringFormat test the overall format of a string