....кьм

how to remove
"{
“documents”: " at the beginning and “}” at the end?

Hi @Vlad_Svitelskyi

  1. Create a new string variable to store the modified string.
  2. Use the “Assign” activity to assign the original string to the new string variable.
  3. Use the “Remove” method to remove the first 15 characters (the characters "{“documents”: ") from the beginning of the string:
newString = oldString.Remove(0, 15)

  1. Use the “Remove” method to remove the last 1 character (the character “}”) from the end of the string:
newString = newString.Remove(newString.Length - 1, 1)

as it is a JSON maybe JSON Processing could be a better approach e.g.

Deserialize JSON Activity - TypeArgument: JObject - output: myJObject

Assign Activity:
strCleansed = myJObject(“documents”).toString

1 Like

Hello @Vlad_Svitelskyi

you can use the below mentioned regular expression to get the required string from your input.

(?<=: ).+(?<=])

Note: multiline option should be enabled in the properties.

Cheers

Hello @Vlad_Svitelskyi ,
Try Regex Replace method
Read the data as a text and stored it in YourString Variable as a string type
Use 2 assigns with the same variable

YourString=System.Text.RegularExpressions.Regex.Replace(YourString,"(?<=])\W+","").ToString

YourString=System.Text.RegularExpressions.Regex.Replace(YourString,"[\D\d\W]+(?=\[)","").ToString

@Vlad_Svitelskyi, Also try this regex match

YourString=System.Text.RegularExpressions.Regex.Match(YourString,"(?=\[)[a-zA-Z\W\s\n\d]+(?=\]).").ToString