Save the file as cv3.01temp.tex and enjoy. ;-)
\documentclass{article}
\makeatletter
\edef\revision@prefix{\detokenize{%
% customize based on the file name structure
cv% <---- change the characters before %
}}
\edef\revision@postfix{\detokenize{%
% customize based on the file name structure
temp% <---- change the characters before %
}}
\begingroup\edef\x{\endgroup
\def\noexpand\revision@get\revision@prefix##1\revision@postfix\noexpand\@nil{##1}}%
\x
\edef\revision{\expandafter\revision@get\jobname\@nil}
\makeatother
\begin{document}
This document is Rev~\revision.
\end{document}
The \@nil has been kept in case the postfix is empty.
The trick is, besides detokenizing the prefix and postfix for the already explained reason, to define \revision@get so that it has a single argument delimited by the (detokenized) prefix and the (detokenized) postfix followed by \@nil. This is achieved by expanding the strings inside an \edef and then executing the obtained macro.
Actually an argument delimiter is only what follows the parameter in the <parameter text>, so the leading tokens are just required after the macro name.
Just for fun, here's a way to extract the first run of digits and periods from the job name; if no such run is found, \revision is set to ???.
\documentclass{article}
\usepackage{expl3,l3regex}
\ExplSyntaxOn
\cs_generate_variant:Nn \regex_extract_once:nnNTF { nV }
\regex_extract_once:nVNTF { [\d\.]+ } \c_sys_jobname_str \l_tmpa_seq
{ \tl_set:Nx \revision { \seq_item:Nn \l_tmpa_seq { 1 } } }
{ \tl_set:Nn \revision { ??? } }
\ExplSyntaxOff
\begin{document}
This document is Rev~\revision.
\end{document}
\jobname. I have clarified the question. – Guho Oct 10 '15 at 20:54\jobnameis a rather special beast, any "letters" are not letters (catcode 11) but all catcode 12, so the above test won't distinguish letters from numbers in\jobname, i'll add a wrapper to so\jobnameworks in a minute... – David Carlisle Oct 10 '15 at 20:575if\jobnameisfoo5zzz– David Carlisle Oct 10 '15 at 21:03cv3.01-temp? – egreg Oct 10 '15 at 21:07temp% <---- change the characters before %;-) – David Carlisle Oct 10 '15 at 22:23