5 ms·
Mathematica also has its own string pattern sytax http://reference.wolfram.com/language/ref/StringExpression.html http://reference.wolfram.com/language/ref/Str
by carlob 12y ago
Mathematica also has its own string pattern sytax
http://reference.wolfram.com/language/ref/StringExpression.html http://reference.wolfram.com/language/ref/StringExpression.h...
Something like that would be
StringExpression[
"$",
Repeated[DigitCharacter],
".",
DigitCharacter,
DigitCharacter
]
or
StringExpression[
"$",
Repeated[DigitCharacter],
".",
Repeated[DigitCharacter, {2}],
]
or
StringExpression[
"$",
NumberString
]
and the other is
StringExpression[
Repeated[
StringExpression[
Repeated["p", {1, Infinity}],
Repeated["q", {2, Infinity}]
],
{2}
]
]
This can be made more concise since StringExpression has an infix form (~~) and Repeated can sometimes be replaced by postfix ..
- akater 12y ago> Repeated can sometimes be replaced by postfix .. Always, not sometimes. ;-)