How to do a regex match within a specific column and update a row in a different column but within the same datatable

Hello Good People,

Seeking your guidance here on how I can write code that can only do the match of digits for a specific column in DataTable and then update a row in another Column with the same DataTable.
That’s the Regex am using:

match = Regex.Match(.........,"(\d+)")

image

Kindly advise.
Thanks you

Regards,
Kakooza Allan Klaus

Hey!

Before Using the Regex we must have to import the following Namespaces from import Panel…

Reference:

ImportsRegEx

Then Try this:

System.Text.RegularExpressions.RegEx.Match(CurrentRow("ColumnName").ToString.Trim,"\d+").ToString

Regards,
NaNi

1 Like

Hello @Kakooza-Allan-Klaus , Use this expession, you will get number as a string

System.Text.RegularExpressions.RegEx.Match(CurrentRow("column_name").ToString.trim,"\d+").ToString

Then use write cell activity to write the data into another cell or column.

1 Like

This is how I resolved this scenario:

I used the For Each Row In DataTable as shown in the screenshot below:

The match variable is type System.Text.RegularExpression.Match, then am using the If activity to validate if the match is a success or not.

If the match is a success, I use the Update Row Item activity to update the row in the other column as shown in the screenshot below:
And finally I write the data to an Excel File.

image

This is the output that you get after the execution:
image

Thanks to @Gokul_Jayakumar and @THIRU_NANI for contributing to this post.

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