Wolfram: String Expression
What is String Expression
String Expression represents a string pattern. It is WolframLang's alternative syntax comparable to Regular Expression.
String Expression has a syntax that is more readable, and similar to Wolfram: Pattern Syntax for matching symbolic expression structures.
StringExpression[s1, s2, etc]
-
🔸 SHORT SYNTAX:
s1 ~~ s2 ~~ etc
Represents a string pattern, used in string functions that take a string pattern.
WolframLang StringExpression 2022-04-29
StringExpression Short Syntax
StringExpression[ a, b, c, etc ]
is equivalent to
(a ~~ b ~~ c ~~ etc)
StringExpression Pattern Syntax
Example: StringExpression
(* catch email address *) StringCases[ "joe@mcqxf.com and mary@nvsck.org", LetterCharacter.. ~~ "@" ~~ LetterCharacter.. ~~ "." ~~ LetterCharacter.. ] (* {joe@mcqxf.com, mary@nvsck.org} *)
Ignore Case
To ignore case, use the option
IgnoreCase -> True
(* match string, ignore case *) StringCases["Some Thing", StringExpression["thing"], IgnoreCase -> True] (* {"Thing"} *)
WolframLang String
- Wolfram: String
- Wolfram: String Functions
- Wolfram: Get SubString, by Index
- Wolfram: Get SubString, by Pattern
- Wolfram: Delete SubString
- Wolfram: String Split
- Wolfram: String Join
- Wolfram: String Insert
- Wolfram: Convert String
- Wolfram: String Template (format)
- Wolfram: String Match
- Wolfram: String Replace
- Wolfram: Regular Expression
- Wolfram: String Expression
- Wolfram: StringExpression Pattern Syntax
- Wolfram: RegularExpression vs StringExpression