Split the string and get the value in loop

Hi Team,

I have below string and want to split it.

I need output as
Balance Sheet
Central Benefits Admin
Cost Pool*
Direct Charge to Intercompany
Funding Dept
Marriott Rewards
Offset
Ritz Carlton Net Admin
Tuitions
Vendor Credits

Logic is only with the split with capital letter. If anything else suggest me and help me with this.

Thanks

Use the following regex in the find matching patterns activity

([A-Z][a-z]+(\s[A-Z][a-z]+)*|*[a-zA-Z]+|[A-Z][A-Z]+)

and then use a for loop on the output and assign your strings

edit: Screenshot

Previous solution was rather crude. With a little help from ChatGPT:

Use this in your robot:
Assign s_SplitResults --> system.text.RegularExpressions.regex.Split(s_Source, "(?<=[a-z*])(?=[A-Z])")
s_Source being your crude text string
s_SplitResults being an array of string containing the split values as per your requirements.

1 Like

Hi @Sonam_N

Assign activity -> Input = "Balance SheetCentral Benefits AdminCost Pool*Direct Charge to IntercompanyFunding deptMarriott RewardsOffsetRitz Carlton Net Admin TuitionsVendor Credits"
Input is of DataType System.String

Assign Activity -> Output = System.Text.RegularExpressions.Regex.Split(Input,"(?<=[a-z*])(?=[A-Z])")
Output is of DataType Array(System.String)

Message Box -> String.Join(vbCrLf, Output)

Regards

1 Like

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