Extract value between two spaces in the from the input datatable in each row and create another column as “UserID” and place extracted values into new column and store into new or existing Data table Input DB.xlsx (9.1 KB)
.
dt.Columns.add("UserID")
For Each row As datarow In dt.AsEnumerable
row(1)=system.Text.RegularExpressions.Regex.Match(row(0).ToString,"\s[A-Z_0-9]+").Value
row(0)=System.Text.RegularExpressions.Regex.Replace(row(0).ToString,"\s[A-Z_0-9]+","").Trim
Next
dt.Columns.add("UserID")
For Each row As datarow In dt.AsEnumerable
row(1)=system.Text.RegularExpressions.Regex.Match(row(0).ToString,"\s[A-Z_0-9]+").Value.trim
row(0)=System.Text.RegularExpressions.Regex.Replace(row(0).ToString,"\s[A-Z_0-9]+","").Trim
Next