html_content = "<div style=\"padding: 0;\">
<blockquote><span edit=\"false\">test</span></blockquote>
</div>"
html_content.gsub!("<span edit=\"false\">", ")
html_content.gsub!(/<\/span><\/blockquote>/i, "</blockquote>")
html_content.gsub!(/blockquote>/i, "blockquote>")
# Result
# <div style="padding: 0;">
# <blockquote>test</blockquote>
# </div>
span
inside the blockquote
and all of the text inside the span
to move in a blockquote
parent.html_content.gsub!(/<span edit="false">([^<]+)<\/span>/, '\1')
Find more questions by tags Regular expressionsRuby
Bravo! - Bernita commented on April 19th 20 at 12:12