Hi
I want to generate a search preview of an article by removing certain html nodes including the child node(s) (particularly headers and images) and removing all other tags eg. paragraph while leaving child nodes.
e.g.
"<h2>Subject</h2><p>Subject is the who, what, where, why and when.</p>".gsub(/<\/?[^>]*>/, '')
results in
Subject Subject is the who, what, where, why and when.
however I require
Subject is the who, what, where, why and when.
I'm using the Rails plugin Loofah to sanitize user input and this works great; in fact I can define a scrubber to do this however it seems that a regexp would be sufficient for this simple operation.
Thanks in advance for any advice.