Regex.Replace error help

Hello, I am trying to use Regex.Replace to cut the substring ‘TO’ from a sentence.
However, I am encountering an error in the ASSIGN activity, while the LOGMESSAGE activity is not showing any errors.
I would appreciate any advice on the difference between the two.
Thank you in advance for your response!

Hi,

Can you share whole the expression?

Regards,

1 Like

Hi @22222222asas

Can you try the below syntax:

System.Text.RegularExpressions.Regex.Replace(Input,"TO","")

Can you share the expression that you have written?

Regards

1 Like

@Yoichi
Thank you for the response!

This is the code
System.Text.RegularExpressions.Regex.Replace(item,“TO”,“”)

@Parvathy

Thank you for the response!

This is the code
System.Text.RegularExpressions.Regex.Replace(item,“TO”,“”)
Still, an error occurs

Hi,

It may be validator problem. Can you try to clear right side expression and unfocus, then re-input it?

System.Text.RegularExpressions.Regex.Replace(item,"TO","")

Regards,

1 Like

Hi @22222222asas

Can you try the below syntax:

System.Text.RegularExpressions.Regex.Replace(item.ToString,"TO","")

or you can use the below syntax:

item=item.ToString.Replace("TO","")

Hope it helps!!

1 Like

@22222222asas

Create a variable Str_Input

Str_Input=item.ToString.Replace("To","")

Hope this helps you

1 Like

@Yoichi
Thank you for the response! However, errors continue to occur.
Is there an issue with the Argument type, as shown in the screenshot?

@Parvathy
Thank you for the response! However, errors continue to occur.
Is there an issue with the Argument type, as shown in the screenshot?

Hi,

Can you try to change Object to String in ArgumentType?

Regards,

1 Like

@rlgandu

Thank you for the response! However, errors continue to occur.
Is there an issue with the Argument type, as shown in the screenshot?

@22222222asas

Please change the argument type to string

1 Like

Hi @22222222asas

Change the Argument type from Object to String

Regards

1 Like

@Yoichi
Thank you for the response.
I succeeded in deleting, but when trying to delete the part @" TO : ',
I am unable to remove the @" Could you please provide a solution?"

@Parvathy
Thank you for the response.
I succeeded in deleting, but when trying to delete the part @" TO : ',
I am unable to remove the @" Could you please provide a solution?"

@rlgandu
Thank you for the response.
I succeeded in deleting, but when trying to delete the part @" TO : ',
I am unable to remove the @" Could you please provide a solution?"

@22222222asas

InputString.Replace(“@”,“”).Replace(“To:”,“”)

1 Like

Hi,

Did you check it at locals panel? As it’s C# syntax , we can ignore it. (It’s not content of the variable)
Can you also check it using MessageBox etc?

The following may also help you.

Regards,

2 Likes

@rlgandu
Thank you for the response!!!
Have a great day today!