There are certain numbers in a row where there are alphabets after numbers in a row and columns. I need to remove the characters or alphabets after the numbers in Workbook using UiPath
Hi @ayushi_jain3 ,
Could you provide us with some sample data to check it out, if provided also the Expected Output from it, it would further be helpful to accelerate the reach of Solution.
Hey, thanks for the quick response. Could you please provide the value set for assign and in the configure regular expression so that I can try it from my end. Thanks in advance !
Hi, set this value for assign.
System.Text.RegularExpressions.Regex.Match(row(“Column1”).ToString, “\d+”).Value
Maybe we could use the below Regex Expression :
(.*\d+)(.*)
The implementation assuming that you are reading the Excel sheet as Datatable, we can perform the following :
The Assign
Statements are below :
CurrentRow("Company ID") = Regex.Match(CurrentRow("Master Tax").ToString,"(.*\d+)(.*)").Groups(2).Value.ToString
CurrentRow("Master Tax") = Regex.Match(CurrentRow("Master Tax").ToString,"(.*\d+)(.*)").Groups(1).Value.ToString
After the Operation, we could use Write Range
activity to Write the Updated Data back to the Excel sheet.
Hello All,
I used other solution and it worked for me, so just wanted to share:
- Read range: output: dt1
- Invoke code activity: Use below code
Dim dt1 As DataTable = in_dt1
For Each row As DataRow In dt1.Rows
row(“Column_Name”) = System.Text.RegularExpressions.Regex.Replace(row(“Column_Name”).ToString(), “[a-zA-Z]+$”, “”)
Next row
- Write range
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.