Hi folks need a help

I have to seperate chacters and numbers from a sample string and save them in seperate columns in an excel i tried to do that couldnt suceed,can u pls help me to do that,thanks in advance.RegexToSplit.xaml (9.4 KB)

1 Like

Hi
Welcome to uipath community
Can I have that sample string if possible
Cheers @Naseem_Banu

1234uiPath
blueprism567
AA 2340

1 Like

[quote=“Naseem_Banu, post:3, topic:184241, full:true”]
1234uiPath
blueprism567
AA 2340

2 Likes

Awesome
Hope these steps would help you resolve this
—lets take you have string stored in a text file
—now use a READ TEXT file activity and pass the file path of that text file and get the output with a variable of type string named strinput
—now use a BUILD DATATABLE activity and create a datatable with two columns of both being type string named Number, String and get the output with a variable of type datatable named Finaldt
—then use a assign activity like this
arr_lines = strinput.Split(Environment.NewLine.ToArray())
Where arr_lines is a variable of type array of string

—then use a FOR EACH activity and pass the above array variable as input and change that you argument as string in the property panel

—inside the loop use a first assign activity like
str_number = System.Text.RegularExpressions.Regex.Match(item.ToString,”(\d)+”).ToString

—then another assign activity like this
str_text = System.Text.RegularExpressions.Regex.Match(item.ToString,”[a-zA-Z]+”).ToString

—Now use a ADD DATAROW activity and mention the input datatable as Finaldt in datatable property and in ArrayRow property mention like this
{str_number, str_text}

Then this will add the matches for each line to the datatable for each row one by one

—then next to this for each loop use a WRITE RANGE activity and pass the datatable dt as input and enable add headers this will enter that to excel file

Cheers @Naseem_Banu

thk you so much it worked for 2 lines,but it is not printing th characters from first row,
RegexToSplit (1).xaml (9.9 KB)

for the string “uipa1th1234”
its just printed uipa ,1 ,1234
th isnt printed in excelRegexToSplit (1).xaml (9.9 KB)

1 Like

Great

But this condition was not mentioned along to question buddy or even with the sample string given
No worries
Have a great day
@Naseem_Banu

1 Like

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