Getting replace to read | as "|" not regex Or command?

Hey guys I’m having trouble with the replace command and I’m wondering if this is just a limitation in how the program will read the string. I’m trying to replace a string “sqft|Landing” with “sqft||Landing” but the Replace activity is reading “sqft|Landing” as Regex so its matchign “sqft” or “Landing” which appears many times, rather than the string “sqft|Landing” which appears once.

Are pipe characters able to be read as non regex or is this just a character that needs to be avoided which working in the program? Thanks.

@css
use an assign activity
YourStringVar.Replace("sqft|Landing”,"sqft||Landing”)
and assign it to YourStringVar

1 Like

Thanks @ppr that worked beautifully. Is it safe to say that the Replace activity is more of a regex specific tool where Assign has generally more use?

@css
from docu:

UiPath.Core.Activities.Replace

Within a specified input string, replaces strings that match a regular expression pattern with a specified replacement string. This activity has a RegEx Builder wizard that can be used to configure it, on which you can read more here.

the replace function used within assign comes from the string implmentation .net:

1 Like

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