Reputation: 15151
There is a html text like this:
html = '<div class="foo"><span class="bar">text<br>with line break</span></div>'
doc = Nokogiri::HTML(html)
And I want to get the text text<br>with line break
.
Currently I'm using
doc.css("span").to_html.match(/<span .+?>(.*)<\/span>/){ $1 }
Is there simpler way to make it? If possible I want to avoid using regular expression.
Upvotes: 2
Views: 1171