Error in Regex Expression

Hi All,

I am trying to remove special characters in DataTable using regex (Here I dont want $,USD and any space or dot.

I am using following regex expression however getting error

(From r In DT1.AsEnumerable

Select ra = r.ItemArray.Select(Function (x) System.Text.RegularExpressions.Regex.Replace(x,“[^a-zA-Z0-9]”,“”)).ToArray()
Select dtout.Rows.Add(ra)).CopyToDataTable()



Hi @marina.dutta

There is a small modification in the code, check the below one,

(From r In DT1.AsEnumerable
Let ra = r.ItemArray.Select(Function (x) System.Text.RegularExpressions.Regex.Replace(x.toString,"[^a-zA-Z0-9]","")).ToArray()
Select dtout.Rows.Add(ra)).CopyToDataTable()

Hope it helps!!

@mkankatala

one more thing. I need to remove the USD from D column also. Can I include in same expression?

Could you raise new query for this… @marina.dutta

@mkankatala

Tagged you in the new Query. Can you please help on this two below links ?

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