Hey people, I wanted to see if you can use things like a count function or a replace function by using a string rather than the regex of a string? It looked like UiPath only can do these things by using a regex even if the ‘regex’ is simply a section of a string.
What actually you are trying to do can you elaborate it.
Such that count of what words in a string something like that or anything else ??
Er Pratik Wavhal
I just wanted to see if it was always necessary to use a regex-format for replacing data. So lets say you have a paragraph of text with numbers, dashes, special characters, etc. And you extract the third line in that paragraph, and then you want to remove it. Right now I’d do that with an assign or replace function and the ‘regex’ input would be that third sentence in quotes or the variable that houses that third sentence. I was just wondering if that always has to be the case that UiPath has to see it as the ‘regex’ of a string rather than the actual string that I’m using to replace.
Can you share a sample string and mention your output, in this way the problem will be clear and we can help
And I’m wanting to replace “And you extract the third line in that paragraph,” from it. Basically all I’m asking is does Uipath only work with ‘regex’ patterns in situations like this or can it just work with a string that wont be looked at as ‘regex’.
Something like ‘System.Text.replace()’ rather than ‘System.Text.RegularExpressions.Regex.Replace()’
@cssc There is a Direct String Replace method which you can apply on String variables if that’s what you are asking
That is what I’m asking, how do you do that?
And are their other functions than just the replace where uipath defaults to using regex where you could choose to use a string instead (matches, count, etc.)?
You can use youroutputstring.Replace(“Text you want to replace”)
It doesn’t require any regex here.
Hope this Helps
@cssc In general I don’t quite understand what you are asking, Bu if you want a String Replace example. You can Check below :
Let’s say you have a String type variable str having the value = “Hello World”
You can use String Replace to replace the Letter “o” with another Letter in this way :
The Output would be :
Yes, that is essentially all I’m asking – wanting to be able to use functions like ‘Replace’ without having the string I’m replacing as being seen as regex.
Like if I’m replacing a specific changing set of characters then it makes sense to use regex, but if I’m just replacing a static, one appearance only version of a string there’s no reason for the bot to replace that string in the form of regex.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.