开发者

MySQL search for text in html text field?

There is a CKEditor field on our website which saves it's HTML to a text field in a MySQL database.

What I'm wondering is, if there is a function (regex for example?) that could strip out HTML tags when doing a LIKE match,

e.g. so that searching for:

like '%this is a test%'

would find

'this<strong>is</strong>a test

I get the feeling that it won't be practical/possible, but worth an ask!开发者_JAVA百科


I think your better bet would be to strip all of the HTML and store a plain-text version of that in your database table. As Ether noted though, don't use REGEX to remove the HTML when you do it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜