How to spilt a string then fill in excel

Hi everybody,
I have a String just like ’ AB123BF234GF432AB223BF342BF345LR234…’ , is there some solution which can fill in EXCEL like the picture below. Thanks!

@zhangbw - So whenever there is a AB then we have to write it in the new line??

So after LR234 if AB256 then will prints on the third row ???

Hi @zhangbw

You can try this way

Use matches activitiy to extract the data from string using below regexes (for each matches activitiy)

AB* : (?=AB)…\d{3}

BF* : (?=BF)…\d{3}

like that . U can extract the data from string

Now use the loop activitiy and use that to fill the collection data one by one

Hope the idea helps you


Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

Hi @zhangbw
Welcome to UiPath Community!
In your input, i notice a pattern of two letters and three digits if that is the case then use Matches Activity and write the regular expression like this:

Which gives you all the matched inputs like this

Then use for each to get each item and write it in excel.


YES, and the quantity of following 'BF***'or ‘GF***’ is not a constant

thanks for your suggestion! But by using matches activity , the output is a list. I hope it can be transformed a Datatable, then I can append it to the excel

Thanks for your suggestion!

1 Like

@zhangbw - Thanks…If you loop the matches you will get a list or you can add that to datatable …

But the tricky portion is, it will write everything in one column where you wanted it to write in a certain way…