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.
MySQL 中是否有任何方法可以在不使用 REGEX 的情况下选择包含可选(0 或 1)字符的术语?例如,我希望 SQL 查询同时匹配 xxx_yyy 和 xxxyyy。希望这很清楚。
WHERE foo = 'xxxxx' OR foo LIKE 'xx_xxx'
在 aLIKE中,下划线恰好匹配一个字符。
LIKE
但实际上,为什么REGEXP不受欢迎?这不是更好吗?
REGEXP
WHERE foo RLIKE 'xx.?xxx'