Type Into: Index was Outside the bounds of the array

Hello,

Am using a Type into activity. The text box is available in the screen and is indicated and highlighted properly. But, when the BOT is running, the following error is thrown. “Index was Outside the bounds of the array”.

Value used in Type Into activity: Variable1.Split(“By”)(1).Split(“(”)(1).Replace(“)”,“”)

Variable1: “ModifiedByUser1”

Requesting for your help. Thank you

Hi @shahidh.aqeel.shahul

There is no open and closed braces in the Input “ModifiedByUser1”

In the expression you have split with braces it will not work it will throw the exception.

From the Input what is your required output.

Hope it helps!!

Hi @mkankatala

The required output is: User1

Can you please help me with the expected expression.

Thank you…

HI,

It may be better to use the following expression.

System.Text.RegularExpressions.Regex.Match(variable1,"(?<=By).*").Value

Also share reason for using .Split(“(”)(1).Replace(“)”,“”) part?

Regards,

Okay @shahidh.aqeel.shahul

Then use the below one,

- Assign -> Input = "ModifiedByUser1"
- Assign -> Output = Input.Split("By").Last

Use the below workflow for String Manipulation,

Or

You can use the below regular expression -
image

- Assign ->Output = System.Text.RegularExpressions.Regex.Match(Input,"(?<=By).*").Value

Check the below workflow by using regex

Hope it helps!!

1 Like

Hello @Yoichi

This worked.

Thank you…

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