我想在mysql中查询所有匹配以下模式的字符串。
至少一个非空字符,
后跟文字破折号字符 -
,
然后后跟至少一个非空字符,
然后后跟文字字符串 in ('true')
“的子字符串” and
“不能出现在两者之间 -
以及 in ('true')
.
例如:
segment-123 in ('true')
符合上述模式。
content-foo and segment in ('true')
与上面的模式不匹配,因为它有子字符串“ and
“中间 -
以及 in ('true')
.
在mysql中使用regexp可以实现吗?非常感谢您的帮助。
1条答案
按热度按时间46scxncf1#
看到了吗https://dev.mysql.com/doc/refman/8.0/en/regexp.html#regexp-有关mysql中正则表达式语法的更多文档。