tags:

views:

23

answers:

1

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.]%',
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.

+2  A: 
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.

Bill Karwin