Q:

Using ted (or another package) instead of etoolbox for patching commands in memoir?

Another question related to my university's odd ToC style requirements. Regular chapters in the ToC need to have all-caps titles, and appendices need regular-case titles. I have a perfectly elegant etoolbox solution
\documentclass{memoir}
\makeatletter
\usepackage{etoolbox}
\patchcmd{\@chapter}%
{\addcontentsline{toc}{chapter}}%
{\let\f@rtocold\f@rtoc%
 \def\f@rtoc{\uppercase\expandafter{\f@rtocold}}%
 \addcontentsline{toc}{chapter}}%
{\typeout{Chapter Patch Succeeded}}%
{\typeout{Chapter Patch Failed}}
\makeatother
\begin{document}
\tableofcontents*
\chapter{One}
This is chapter 1.
\appendix
\chapter{Alpha}
This is appendix A.
\end{document}

but it seems PCTeX 6 doesn't have e-TeX support built in (waiting on registration at the PCTeX forums so I can ask about that directly). I don't use it myself, but some people here do, and I'd like to avoid having them change TeX systems if possible.
I can't use memoir's built-in \patchcommand, since \@chapter has delimited arguments. I've tried using \Substitute* from ted, but no success yet. Replacing the commands between \makeatletter and \makeatother above with the following:
\usepackage{ted}
\Substitute*[\renewcommand{\@chapter}]{\@chapter}%
{\addcontentsline{toc}{chapter}}%
{\let\f@rtocold\f@rtoc%
 \def\f@rtoc{\uppercase\expandafter{\f@rtocold}}%
 \addcontentsline{toc}{chapter}}

I get Use of \@chapter doesn't match its definition. How can I convince \Substitute* to modify a command with arguments?

A:

Since \@chapter takes (delimited) arguments, we need to write them explicitly. \Substitute* expands \@chapter[#1]{#2} to the replacement text of \@chapter with the correct arguments. It then replaces \addcontentsline{toc}{chapter} by the thing you want. Finally, we perform the definition. The extra set of braces is to prevent the optional argument from terminating too early (when seeing ##1]). We double hash because somewhere in the middle of all this ted stores the final action into a control sequence.
\documentclass{memoir}
\makeatletter
\usepackage{ted}
\Substitute*[{\gdef\@chapter[##1]##2}]{\@chapter[#1]{#2}}%
{\addcontentsline{toc}{chapter}}%
{\let\f@rtocold\f@rtoc%
 \def\f@rtoc{\uppercase\expandafter{\f@rtocold}}%
 \addcontentsline{toc}{chapter}}
\makeatother
\begin{document}
\tableofcontents*
\chapter{One}
This is chapter 1.
\appendix
\chapter{Alpha}
This is appendix A.
\end{document}

