Let's say I have this data:
First line of text etc etc
Second line of text here
I want to return the first line, and I know how it starts, but not how it ends, only if it ends with a line break. This is what I still have:
SELECT
SUBSTRING(`file`, LOCATE('First line', `file`), LOCATE('First line', `file`)+10)
FROM `test`
This works, except +10it will not always be +10. The only marker I need to know where to stop is a new line, but I donโt think you can use the regex in SUBSTRING. Is there any way to do this?
source
share