1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
\cdbalgorithm{replace\_match}{}
Replaces a subset of terms in a sum or list which match the given
pattern. This is like a substitute, but always acting on entire terms.
\begin{screen}{1,2}
A + B D G + C D A;
@replace_match!(%)( D Q?? -> 1);
A + 1;
\end{screen}
Note the difference with \subscommand{substitute},
\begin{screen}{1,2}
A + B D G + C D A;
@substitute!(%)( D Q?? -> 1);
A + G + A;
\end{screen}
See \subscommand{take\_match} for further details on how to use this
``select/modify/replace'' mechanism.
\cdbseealgo{take_match}
\cdbseealgo{substitute}
|