Trouble using Regex in Assign Activity

Hi I am trying to use regex in an assign activity. I have this as my variable as String.
I am trying to replace the first occurence of a , in my input string

The variable is insuredAddressInput

My Value is set as
Regex.Replace(insuredAddressInput, “,”," ", 1)

The error I am getting is “Reference to a non-shared member requires an object reference”


Perhaps you should write as the following.
System.Text.RegularExpressions.Regex.Replace(insuredAddressInput,","," ")

You should use RegexOptions enum in the forth argument if necessary.



Thanks that worked. But I cannot use the count option of 1 for some reason.

It says Overload resolution failed because no accessible replace can be called with this argument.

Does anyone know a way to replace only the first occurrence of a character with regex? If options cant be used.


Please try the following

System.Text.RegularExpressions.Regex.Replace(insuredAddressInput,"^([^,]*),","$1 ")



Thanks that worked.

If anyone also has any website or documentation on how to use regex could you link me some guides or tutorials? If there are any on how to use one with UIPath specifically that would be nice.

@Keithm This website had a pretty fantastic cheat sheet for RegEx that I’ve been using lately:

Although not as comprehensive, this one is solid as well: