Use :.Trim
to replace white spaces from values. This seems to be the cause.
Thanks Adrian for your help, is there any proposal solution? I try to remove the duplicate first before the split but it donât work as well.
Send the workflow and a file with sample data (they can be pseudo data)
I will take a look at what you have prepared and refer to it.
How to remove duplicate.zip (16.0 KB)
Hi Adrian,
Attach is the file and thanks you so much for your help in advance.
Hi Adrian,
Your solution is very cools and I didnât know it can be done this way. Something new to learn and thanks you so much for your solution and it work great!
Once again thank you so much.
Very informative. Thanks a lot.
Thanks you for this. This was really helpful!
Hi good morning.
I am creating a bot that captures a text of type Int from the screen and this captured text always changes length, going up to 5 characters or more. I need regardless of the fetched text to save the text from the first digit to the penultimate.
Can you help me please, thank you.
You can use a regular expression:
output = System.Text.RegularExpressions.Regex.Match(inputString,"\b\d+(?=\d)").Value
output = String
inputString = String
Output as shown on screen:
Example link to visualize:
Pattern explanation:
start with the word boundary ( \b ),
get numbers that are more than 1 ( \d+ ),
end on a one-digit pattern without taking a character ( (?=\d) ).
How to split the string if my string is of the format
Mat
cat
rat
fat
and I want one word at a time?
Can anyone help?
Hi,
solution to your problem:
arr_text As Array of Strings
arr_text = Split(your_text, Environment.NewLine)
Usage details in the first post:
Hi Adrian,
The above mentioned isnt giving me the result.
Can you show with a example
I am trying this
Split(Collection, Environment.NewLine)
where âCollectionâ is a string type variable
This worked for me - text.Split(Environment.NewLine.ToArray,StringSplitOptions.RemoveEmptyEntries)
Thanbk you
@Adrian_Star,
I cannot thank you enough your article has been very useful in making me understand string manipulation.
I have written a regex that seems to be working but I get this error:
Self referencing loop detected with type âSystem.Text.RegularExpressions.Matchâ. Path âGroupsâ.
Could you be having an idea on how to resolve it please.
Thank you.
Best Regards,
Kakooza Allan Klaus
Hi @Kakooza-Allan-Klaus ,
Please include your regex pattern here along with a description of what you want to extract. Also include sample text with data. Then I will be able to check the pattern and give you the answer.
Hi @Adrian_Star,
As requested.
C:\\\w*\s*\w*\\\w*.xlsx
C:\folder Name\6639a06d28484664ac15dfedf95a0e37.xlsx
Best Regards,
Kakooza Allan Klaus
sample = "C:\folder Name\6639a06d28484664ac15dfedf95a0e37.xlsx"
pattern = "C:\\[\w\s]+\\\w+.xlsx"
regex_result = System.Text.RegularExpressions.Regex.Match(sample, pattern).Value
Do you have a logical expression like mine in the regex_result
variable?
Yes,
But the are patterns are different
I want to know what could have been wrong with mine.
Yours is very stable
The difference is slight.
In my formula, I just optimized regex pattern by fitting a result with a range of \w
and \s
characters.
What does it mean. I grouped the characters \w
and \s
in to []
bracket and assigned them: +
- that is, to match each type of word characters and whitespace in any number starting from 1.