This question is a variant of my previous question requesting a macro that takes the rest of the line as argument. I would like to write a macro that would take the next word as argument, where word boundary is defined as a space or punctuation (say anything which is not a letter, a digit, or the colon character).
The difficulty lies with the fact that a normal \def can be set to expect a specific character, not a set of characters.
This is not a theoretical challenge---the concrete application is a macro that will do better references, so instead of writing Lemma~\cite{Lemma:Kantor}, one could write \cf Lemma Kantor
An approximation is
\def\cf #1 #2 {#1~\ref{#1:#2}}
but of course it would fail in cases it is used just before punctuation.
