Pattern-matching algebraic expressions!

Match

Match! ✓

Captured groups

Group Expression

Examples

Special elements

?
Match anything
??
Match anything or nothing (optional term)
expr;g
Capture expr in the group named g.
m_any(expr1,expr2,...)
Match any of the expressions exprN
m_all(expr)
Capture all terms matching expr
m_pm(expr)
Capture expr or -(expr).
m_not(expr)
Match anything except expr
m_uses(name1,name2,...)
Match any expression which uses the named variables
m_commute(expr)
Match the terms in expr in any order, following the laws of commutativity. (Use if you only want to use commutativity in certain places)
m_nothing
Match nothing. Useful as an empty term to set up a sum where you want all terms to match one pattern.