Forum Discussion
tipper1510
Jun 28, 2024Brass Contributor
String functions within playbooks
Hi, Have the following string that I need to tidy up: "hostname","{\r\n \"LastLog\": [\r\n \"2024-06-25T16:15:35.751991Z\"\r\n ]\r\n}" so it can have hostname 2024-06-25 16:15:35 ...
Clive_Watson
Jun 28, 2024Bronze Contributor
Hello, you probably should look at extract() or even parse() - assuming this is KQL within the playbooks?
Here is a simple example to get you going
let txt = '"hostname","{\r\n \"LastLog\": [\r\n \"2024-06-25T16:15:35.751991Z\"\r\n ]\r\n}"';
print txt
| parse txt with *'"' HostName_ '"' *
| parse txt with *'[\r\n \"' Date_ '\"\r\n ]' *