Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在一个字段中有这样的数据:
This is where a sentence ends. This is a new sentence.
说我想得到第一句话。
SELECT * FROM `mytable` WHERE `file` REGEXP 'This is where a sentence ends.\n'
这不返回任何行。我也试过\\n, \r, \\r
\\n, \r, \\r
你如何表达换行符?
你按照\n你列出的那样做。确保在句号之后没有任何多余的空格,因为这可能会破坏匹配。另外,请注意,.您的正则表达式中的 被解释为any character- 所以您需要像\.获得文字句点一样转义它。
\n
.
any character
\.