views:

183

answers:

1

Is there a way to execute a SQL statement in SQLite to remove all the html from a TEXT field?

+1  A: 

No. HTML is not parseable by regex, not if you want to be sure about the result.

But you could create an SQLite linked C/C++ application and register a function (http://sqlite.org/c3ref/create_function.html) that does your sanitizing.

Then it's just a matter of issuing update your_table set text = sanitize(text). The sanitize() function should build the DOM tree and grab the TEXT information.

Pasi Savolainen