Thanks, that's exactly what I was looking for!
With a small modification, of course: It needs either the parens removed from the first regex, and $1 replaced with $@, or the parens moved to surround the whole expression. That caught me out initailly, as the 'pre' tags weren't coming out ;)