I would like to comment out each line which has the following match
^.*pdf
You need to somehow consider the situation by globbing. I try to make an object of the match by brackets.
I run unsuccessfully the following commands
%s/^(.*pdf)/^%$1/
and
%s/^(.*pdf)/^(%*$1)/
and
%s/^(.*pdf)/^%\$1/
How can you comment out the matches in Vim?