I have data like this in a field:
This is where a sentence ends.
This is a new sentence.
Say I want to get the first sentence.
SELECT * FROM `mytable` WHERE `file` REGEXP
'This is where a sentence ends.\n'
This returns no rows. I’ve also tried \\n, \r, \\r
How do you express a line break?
You do it with
\nlike you listed. Make sure there aren’t any spare spaces after the period as that could screw up the matching. Also, note that the.in your regex is being interpreted asany character– so you need to escape it like\.to get a literal period.