Split string from text?


I want to split to 1 part
String1 = “RO345879”
Please guide me about it.
I tried using ExtractTable activity but didn’t get the information I wanted. I also tried trimming the string by newlines, but it is too slow!

Hi @Tuannna1
Welcome to UiPath community
Use get text activity get the text and split it by using below code
Data.split(‘:’)(1)- this gives that text

When I use your code it gets redundant “Name”.
image

String1.Split(":"c)(1).ToTrim
Let me know if it doesn’t work for you

I tried a combination with subString:
out textRenderInfo.Split(":"c)(1).Substring(1,8)
image

The result is successful but if the value of TaxID changes there will be a problem.

@Tuannna1
Can you give extracted text first from get text activity?

Try regex pattern
System.Text.RegularExpressions.Regex.Match(String1,@"(?<=TaxID:.*<=Name)").Value.ToString().Trim()

Well, the text is below:
“TaxID: DE767565
Name: Maxitronic Limited
Address: Bingauer Strasse 45
City: Koln, Germany”
image

Then split it again by text.split(" ")(0)

Use below code to extract the value

Convert.ToString(String1.Split(Environment.Newline)(0)).Split(":"c)(1)

Regards,
Arivu


regex is wrong!

Hi @Tuannna1,

What about this

Input
image

Output
image

  1. get text
  2. Split the get text value like below

st.Split(Environment.NewLine.ToArray)(1).Trim.Split("TaxID: ")(1)

Thanks,

1 Like

Thank you, I have tried it successfully.

1 Like

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