Answer the question
In order to leave comments, you need to log in
How to shorten 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>
span
inside and move blockquote
all the text inside to the parent. span
blockquote
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question