WolframLang: 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 WolframLang: 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.
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
- WolframLang: String
- WolframLang: String Functions
- WolframLang: Get SubString
- WolframLang: Convert String
- WolframLang: Format String
- WolframLang: String Match
- WolframLang: String Replace
- WolframLang: Regular Expression
- WolframLang: String Expression
- WolframLang: StringExpression Pattern Syntax
- WolframLang: RegularExpression vs StringExpression