This is a solution that I am using to replace all instances of <p><ol>
,<p><ul>
to <ol>
and <ul>
respectively.
text = text.gsub("<p><ol>","<ol>")
text = text.gsub("<p><ul>","<ul>")
text = text.gsub("<p><p>","<p>")
text = text.gsub("</ol>","</ol><p>")
text = text.gsub("</ul>","</ul><p>")
I am trying to figure out a way to simplify those lines using regex, or any other ways that works for Rails to do those lines. Am not great in regex or know the limitations so any help would be great
question from:
https://stackoverflow.com/questions/66060174/looking-for-a-way-to-simplify-multiple-gsub-lines 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…