in reply to Adding <pre> at beginning </pre> at file end

You can use two substitutions, one anchored to the start of the string, one anchored to the end of the string. See perlretut for a gentle introduction to regular expressions - it's not all that hard to come up with the solution yourself.
  • Comment on Re: Adding <pre> at beginning </pre> at file end