gsub, help please

I want to find all content between <code> tags in a string and replace
the content of these with new formatted content. Any suggestions why the
following code is not working?

self.content = self.content.gsub(/<code>(.*?)<\/code>/, 'new content')

Nope, because it is working:

irb(main):026:0> "This is <code>stuff</code>".gsub(/<code>(.*?)<\/

/, 'new content')

=> "This is new content"

You need to provide more details and code if you're experiencing something different.


found that it breaks if there is a new line '\n' within the <code>. Does anyone know how to get the (.*?) to accept new lines ( \n )

you can set a multiline regexp pattern by adding m after the pattern, like in /.*/m


javier ramirez