GCI.unescape gives <code> tags generation

def coderay(text)
text.gsub(/<pre( )?="" lang="(.+?)"><code( )?=""
lang="(.+?)">(.+?)</code></pre>/m) do
lang = $4
text = CGI.unescapeHTML($5).gsub /<code( )?=""
lang="(.+?)">|</code>/, “”
text = text.gsub(’
’, “\n”)
text = text.gsub(/<([A-Za-z0-9])[>]/, ‘’)
text = text.gsub(’>’, “>”)
text = text.gsub(’<’, “<”)
text = text.gsub(’ ‘, " ")
text = text.gsub(’&’, “&”)
CodeRay.scan(text, lang).div(:css => :class)
end
end

Using the above gives:

</code(></code(></pre(>

Any other way of writing?:

text = CGI.unescapeHTML($5).gsub /<code( )?=""
lang="(.+?)">|</code>/, “”