Need help with using Split to split up a long string

I have a business need to split a the string content of a txt file. The content of the file is :slight_smile:

I want to split it on the word “SUCCESS” so the content should now look like either :
image

OR

image

I have looked at similar issues, but I have not found one that actually did address my issue. I have attached a workflow that I was using here. While I try to see if I can get it to work, I would appreciate help.

substringAStringUsingAWord.zip (3.3 KB)

Hi @Yomi_Oluwadara

You can try this regex in For Each Activity

System.Text.RegularExpressions.Regex.Matches(readFile, "\{([^}]*)\}")

Change the argument type to

System.Text.RegularExpressions.Match

Cheers

1 Like

HI,

Another approach: regex pattern "{[^{]+" also helps you. This returns the first result.

Or, if you need to extract each value, the following will help you.

"{""(?<TYPE>.*?)"":""(?<CONTENT>.*?)""}:(?<STATUS>[^{]*)"

Sample
substringAStringUsingAWordV2.zip (3.7 KB)

Regards,

@rikulsilva Thanks! That was a good approach!

@Yoichi Thanks a lot! the solutions were awesome, thanks for the education.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.