How to extract the substring from a data table column

I have a DataTable with only one column and I want to extract the specific portion from each row of that data table

This is my Data table
image

I want to extract the portion that is on the left side of three hyphens (“—”)
The output data table should be like this
image

1 Like

@Sami_Rajput try this
basically in for each row activity
assign
CurrentRow("Document") = System.Text.RegularExpressions.Regex.Split(CurrentRow("Document").ToString, "---")(0)
uipathF.xaml (9.3 KB)

1 Like

is the data come in the same format? I would use the regex capturing groups pattern =>

Regex pattern = (\w{3})-(\d{8})

in for each row

System.text.RegularExpressions.Regex.Match(row.item(“Document”).ToString.Trim,“(\w{3})-(\d{8})”).ToString

1 Like

@jack.chan
Thankyou!

1 Like

no problem, good luck :slight_smile:

1 Like

@whitestar
Thanks for your help!
Currently, I am not so familiar with REG-Ex, but I will try this for sure!

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