删除 KQL 中的特殊字符
Remove Special Characters in KQL
如何从下面的列值中删除 KQL 中的 [" 和 "]?
["xyz@test.com"]
["abc@test.com"]
["123@test.com"]
谢谢
我想您也想删除双引号。
datatable(col:string)
[
'["xyz@test.com"]'
,'["abc@test.com"]'
,'["123@test.com"]'
]
| extend option_1 = trim(@'^\["|"]$', col) // Trim opening [" and closing "]
| extend option_2 = trim(@'[[\]"]+', col) // Trim sequences of the characters [, ] and "
| extend option_3 = extract(@'^\["(.*)"]$', 1, col) // Extract the expression between the opening [" and closing "]
| extend option_4 = tostring(todynamic(col)[0]) // Convert to json (resulting in json array) and retrieve the 1st element
col
option_1
option_2
option_3
option_4
["xyz@test.com"]
xyz@test.com
xyz@test.com
xyz@test.com
xyz@test.com
["abc@test.com"]
abc@test.com
abc@test.com
abc@test.com
abc@test.com
["123@test.com"]
123@test.com
123@test.com
123@test.com
123@test.com
Fiddle
如何从下面的列值中删除 KQL 中的 [" 和 "]?
["xyz@test.com"]
["abc@test.com"]
["123@test.com"]
谢谢
我想您也想删除双引号。
datatable(col:string)
[
'["xyz@test.com"]'
,'["abc@test.com"]'
,'["123@test.com"]'
]
| extend option_1 = trim(@'^\["|"]$', col) // Trim opening [" and closing "]
| extend option_2 = trim(@'[[\]"]+', col) // Trim sequences of the characters [, ] and "
| extend option_3 = extract(@'^\["(.*)"]$', 1, col) // Extract the expression between the opening [" and closing "]
| extend option_4 = tostring(todynamic(col)[0]) // Convert to json (resulting in json array) and retrieve the 1st element
col | option_1 | option_2 | option_3 | option_4 |
---|---|---|---|---|
["xyz@test.com"] | xyz@test.com | xyz@test.com | xyz@test.com | xyz@test.com |
["abc@test.com"] | abc@test.com | abc@test.com | abc@test.com | abc@test.com |
["123@test.com"] | 123@test.com | 123@test.com | 123@test.com | 123@test.com |
Fiddle