How can I remove [" and "] in KQL from the below column values?
["[email protected]"]
["[email protected]"]
["[email protected]"]
Thanks
I guess you would also like to remove the double quotes.
datatable(col:string)
[
'["[email protected]"]'
,'["[email protected]"]'
,'["[email protected]"]'
]
| 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 |
|---|---|---|---|---|
| ["[email protected]"] | [email protected] | [email protected] | [email protected] | [email protected] |
| ["[email protected]"] | [email protected] | [email protected] | [email protected] | [email protected] |
| ["[email protected]"] | [email protected] | [email protected] | [email protected] | [email protected] |
Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With