Hacker News new | ask | show | jobs
by carlob 4139 days ago
Mathematica also has its own string pattern sytax

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 ..
1 comments

> Repeated can sometimes be replaced by postfix ..

Always, not sometimes. ;-)