更新时间:2023-01-30 22:49:52
>
EDITED to incorporate fix to valid critisism
使用 HEX()
函数将您的字节呈现为十六进制,然后使用 RLIKE
,例如:
Use the HEX()
function to render your bytes to hexadecimal and then use RLIKE
on that, for example:
select * from mytable
where hex(ipa) rlike concat('(..)*', hex('needle'), '(..)*'); -- looking for 'needle' in haystack, but maintaining hex-pair alignment.
奇数unicode字符一致地呈现其十六进制值,因此您正在搜索标准0-9A -F chars。
The odd unicode chars render consistently to their hex values, so you're searching over standard 0-9A-F chars.
这也适用于正常列,你只是不需要它。
This works for "normal" columns too, you just don't need it.
ps @ Kieren的(有效)点使用 rlike
来强制执行字符对
p.s. @Kieren's (valid) point addressed using rlike
to enforce char pairs