diff --git a/railties/guides/rails_guides/textile_extensions.rb b/railties/guides/rails_guides/textile_extensions.rb
index 460dab18c3..794083b44b 100644
--- a/railties/guides/rails_guides/textile_extensions.rb
+++ b/railties/guides/rails_guides/textile_extensions.rb
@@ -31,10 +31,10 @@ module RailsGuides
end
def code(body)
- body.gsub!(/\<(yaml|shell|ruby|erb|html|sql)\>(.*?)\<\/\1\>/m) do |m|
+ body.gsub!(%r{<(yaml|shell|ruby|erb|html|sql)>(.*?)\1>}m) do |m|
es = ERB::Util.h($2)
css_class = ['erb', 'shell'].include?($1) ? 'html' : $1
- %{#{es}\n
}
+ %{#{es}
}
end
end
end