str =
"bc. some text
more text
even more
^ above here is the empty line
bc. some text
more text
even more
^ above here is the empty line"
puts str.gsub(/^bc\. (.*?)\n\n/m, "<pre>\n\\1\n</pre>\n\n")
Output:
<pre>
some text
more text
even more
</pre>
^ above here is the empty line
<pre>
some text
more text
even more
</pre>
^ above here is the empty line
Explanation
?
in .*?
makes the star operator non greedy
/m
modifier in the end makes dot match newlines