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
I have attempted to combine replace statements with no luck...
Any ideas..
Many thanks,
Tim
- Clive_WatsonBronze 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 goinglet 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 ]' *