How to cut a regular expression?

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>


the reference to Repl

The point is to remove the span inside the blockquote and all of the text inside the span to move in a blockquote parent.
April 19th 20 at 12:07
1 answer
April 19th 20 at 12:09
Solution
html_content.gsub!(/<span edit="false">([^<]+)<\/span>/, '\1')
@Flo_Weissn
Bravo! - Bernita commented on April 19th 20 at 12:12

Find more questions by tags Regular expressionsRuby