String Patterns

The Wolfram Language's symbolic string patterns provide a compact yet readable basis for sophisticated string operations. Included directly in programs, or symbolically generated on the fly, the Wolfram Language's string patterns can routinely be used on strings with millions of elements.

ReferenceReference

StringExpression a symbolic string-pattern expression ()

_ 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

Whitespace  ▪  NumberString  ▪  DatePattern

WordCharacter  ▪  DigitCharacter  ▪  LetterCharacter  ▪  WhitespaceCharacter

WordBoundary  ▪  StartOfLine  ▪  EndOfLine  ▪  StartOfString  ▪  EndOfString

HexadecimalCharacter

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

Operations »

StringMatchQ  ▪  StringFreeQ  ▪  StringCases  ▪  StringReplace  ▪  ...