One of the field in my database contains data with some html
tags say img
, href
. While querying I want to ignore those tags. If a tag contains href="foo.com"
th开发者_如何学JAVAen my search query for foo in mysql should not brings the foo.com
. It should ignore links, image links etc.
As far as I know, MySQL does not have any sort of built-in HTML parser and I doubt there's a simple way to write one.
My advice is to add a new column to the table with a plain text version of your HTML column and use it to perform searches. Whatever your server-side language is, it's likely to have a library to strip HTML tags. For instance, PHP has strip_tags().
精彩评论