我正在尝试搜索这个模式ab1234。我尝试过col like 'ab[0-9][0-9][0-9][0-9]'
col like '(ab)[0-9]{4}'
col like 'ab####'
,这些都不起作用。我查看了这个网站的https://www.w3schools.com/sql/sql_wildcards.asp,但它不是很有帮助。任何建议都是值得感谢的:)
发布于 2021-02-07 10:08:22
使用rlike进行regexp检查:
col rlike 'ab\\d{4}' --containing ab and 4 digits in any place of the string
或者更严格的模式:
col rlike '^ab\\d{4}$' --Exactly ab and 4 digits, no other characters before or after
发布于 2021-02-08 04:57:08
select * from table where col rlike 'ab[0-9]{4}'
https://stackoverflow.com/questions/66085107
复制相似问题