Login123
(Login123)
January 4, 2021, 6:17am
1
I want regex pattern for this string,
2020-12-23T07:00:01.000000+05:30 45.79.121.190 {“hostname”:“li2119-190memberslinodecom”,“os”:{“name”:“CentOS Linux”,“family”:“redhat”,“version”:“7 (Core)”,“platform”:“centos”,“kernel”:“3.10.0-1127.13.1.el7.x86_64”,“codename”:“Core”},“containerized”:false,“ip”:[“45.79.121.190”,“2400:8904::f03c:92ff:fed4:e4f0”,“fe80::f03c:92ff:fed4:e4f0”],“name”:“li2119-190.members.linode.com ”,“id”:“c29d751565e74afdbaade6c8a36dd2ef”,“mac”:[“f2:3c:92:d4:e4:f0”],“architecture”:“x86_64”}
required output is-
hostname - li2119-190memberslinodecom, name- CentOS Linux, family-redhat, version-7, platform-centos, ker-nel3.10.0-1127.13.1.el7.x86_64, codename-Core, name-li2119-190.members.linode.com , id-c29d751565e74afdbaade6c8a36dd2ef
Can somebody pls help me .
1 Like
Hi @Login123
Welcome to forum
Since the format of string is like json
So you can use deserialize json activity to deserialize the string to jobject from which u can acquire required value by key , value logic
Hope it helps you
Regards
Nived N
Happy Automation
2 Likes
Login123
(Login123)
January 4, 2021, 6:24am
3
Thanks for your reply @NIVED_NAMBIAR ,but i want to do this using regex pattern.
Hello @Login123 ,
use this pattern and Replace your required String (?<=“family ”:“)(.*?)(?=”,) for testing I’ve used family here, you can test with all your input string.
Test here = Click here
Cheers
@Login123
3 Likes
Login123
(Login123)
January 4, 2021, 9:54am
5
@Pradeep_Shiv I tried for other string , but i am facing an error,
how to add multiple patterns?
1 Like
Just use once, replace family instead name
@Login123
1 Like
Login123
(Login123)
January 4, 2021, 10:23am
7
@Pradeep_Shiv I want full regex pattern for all the values…
1 Like
you can assign it for different variables,
@Login123
1 Like
system
(system)
Closed
January 7, 2021, 11:43am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.