Hi Guys
so my scenario is ill receiving a mail which body =
Details:
• Additional Backup Folder File Count : 0
• S3 Additional Backup Folder File Count : 0
Request to be sent for restore: ::{‘s3_backup_location’: ‘s3://aws-a0122-use1-00-s-bbbr-bing-rdmp-bck05/EMR_Backup_New/EMR_bak_189/data/backup_20220708-102932’, ‘key’: ‘XXXXXXXXX’, ‘host’: ‘10.000.05.000’, ‘recipient’: ‘comma separated mail-ids’}
Note: key has been masked for security reasons
This email body will change for the new emails.
So my question is- I need to get the specific string that is ( s3://aws-a0122-use1-00-s-bbbr-bing-rdmp-bck05/EMR_Backup_New/EMR_bak_189/data/backup_0708-102932)
so how to get this value every time
Please let me the solution
Thanks alot
Sanjit_Pal
(Sanjit Pal)
September 5, 2022, 10:43am
2
Jiban_Kumar_Das_TcM:
s3_backup_location
Hey @Jiban_Kumar_Das_TcM ,
As you string is the json string so better to use the deserialization of json and get the value corresponding to the required key.
Have a look on the below thread.
im using this tip to get some info from a txt> https://docs.uipath.com/activities/docs/deserialize-json
but i dont know how to get specific itens inside the “0001”, i want to consult with deserialize json but i want this 3 infos in 3 differents variables, is that possible ? in the link, when i call cars, he get all the 3 infos in one string, how to split it
[image]
all 3 infos in the same string ><
[image]
Thanks,
Sanjit
You can use regular expressions to select specific data
System.Text.RegularExpressions.Regex.Match( StrTextData,“/(?<={‘)([\S\s]*?)(?=’})/gm”).ToString
Hey, this is not a Json string,
I have tried your method
So either string manipulation(preferred) or reggex will work
Hey thanks fr the input
Let me give it a try
It will always get me the newer values as well right ?
& btw do you know the alternative solution using string manipulation?
Jiban_Kumar_Das_TcM:
Details:
• Additional Backup Folder File Count : 0
• S3 Additional Backup Folder File Count : 0
Request to be sent for restore: ::{‘s3_backup_location’: ‘s3://aws-a0122-use1-00-s-bbbr-bing-rdmp-bck05/EMR_Backup_New/EMR_bak_189/data/backup_20220708-102932’, ‘key’: ‘XXXXXXXXX’, ‘host’: ‘10.000.05.000’, ‘recipient’: ‘comma separated mail-ids’}
Note: key has been masked for security reasons
I just tested, this regex isn’t working
Moreover, u could the entire string is highlighted
But as I have mentioned I need only a specific piece from that string I,e "S3 backup location’=
“s3://aws-a0122-use1-00-s-bbbr-bing-rdmp-bck05/EMR_Backup_New/EMR_bak_189/data/backup_20220708-102932 ”
Hi @Jiban_Kumar_Das_TcM ,welcome to our community.
Try this regex expression: (?<={)([\S\s]*?)(?=…key)
I think you will get your desired output.
Thanks & Regards,
Shubham Dutta
See
Still not working
Do you have Any alternatives like string manipulation?
Hi @Jiban_Kumar_Das_TcM ,
I think I you are doing something wrong, I am getting the output you required please go through the code I am attaching.
Main.xaml (5.4 KB)
Do check the input_str in code.
Thanks & Regards,
Shubham Dutta
Hey i just checked its working, but with an issue
& that is when this string is changing(which is obvious for each run)
its not giving me the exact string i.e only “s3 backup path’s value only”
I just ran it with a different S3 backup file path, & this time the path was bigger
so it couldn’t get the entire path
Hi @Jiban_Kumar_Das_TcM ,
please provide me few sample strings.
Actually in the current code you will get the path before ‘key:’, so in every scenario you will get the entire path which is before ‘key:’
I get it
But , see this time it pulled a few further letters
1 more humble request, I’m not so into Regex expression
so can you can you please get me a string manipulation alternative
& thank you so much for your input in this thread