Yes, substitution replacements only work for a single paragraph (which may, however, span several lines).
You may save longer or more complex source snippets to a file and insert them with the "include" directive.