How do I locate instances of <CR><LF><LF> in a mysql longtext field
I would like to query my table for how many rows contain one or more instances of <CR><LF><LF>. I can't figure out the correct syntax. I would try
LIKE '%<CR><LF><LF>%',but I don't know how to specify these special characters. I did try
where mydata REGEXP '%[.CR.][.LF.][.LF.]%',开发者_JS百科and that didn't get a syntax error but neither did it return any rows. So, I realized I need a way to insert the test data as well!
Note: I am using mysql 5.0.
SELECT ... WHERE longtextfield LIKE CONCAT('%', CHAR(13,10,10), '%');
13 = ASCII code for CR
10 = ASCII code for NL (which I think you mean by LF)
See the doc on MySQL's CHAR()
function.
精彩评论