will comment out lines containing
# is your comment character)
Another way of doing this is with normal commands instead of text substitution:
Note: there is a trailing space in this code block
v at the beginning and it will comment out lines that don't match the pattern.