搜索有*的字符串

0 kdb

我有一个包含符号的表*.

q)sl:([] s:(`$"g*g";`$"b*l";`$"bx"))
q)sl
s
---
g*g
b*l
bx
Run Code Online (Sandbox Code Playgroud)

如何在搜索时转义*(通配符号),我想搜索包含*普通字符的所有符号?

例如,这个返回包含'b'的两行,我只想让它返回'b*l'

q)select from sl where s like "b*"
s
---
b*l
bx
Run Code Online (Sandbox Code Playgroud)

Jam*_*tle 5

您可以通过使用周围的特殊字符方括号,如提及做到这一点在这里.

所以在这种情况下:

q)select from sl where s like "b[*]*"
s  
---
b*l
Run Code Online (Sandbox Code Playgroud)

或者匹配其中的任何*内容:

q)select from sl where s like "*[*]*"
s  
---
g*g
b*l
Run Code Online (Sandbox Code Playgroud)