How would you strip HTML tags in PostgreSQL such that the data inside the tags is preserved?
I found some solutions by googling it but they were striping the text be
Any solution performed in the RDBMS is going to involve either string handling or regexes: to my knowledge there is NO way to manipulate HTML in a standards-compliant, safe way in the database. To reiterate, what you are asking for is very, VERY unsafe.
A much better option is to do this in your application. This is application logic, and NOT the job or concern of your storage layer.
A great way to do this (in PHP, at least) would be HTML purifier. Don't do this in JavaScript, the user can tamper with it very easily.