in reply to s/[newline]FOO[newline]/\\bar{foo}/sg
If there are no spaces before and after the word, remove them from the regex.
qq