Hi There,
I am extracting a data table and the data is coming as below.
Input -
KHR P-25031 : RESOLVED summary items in List
KHR P-250350 : RESOLVED summary items in List
KHR P-2503800 : RESOLVED summary items in List
KHR P-25031500 : RESOLVED summary items in List
KHR P-250320000 : RESOLVED summary items in List
KHR P-25034000000 : RESOLVED summary items in List
I want to extract the value starting from P and till : , no space is required.
Mainly i want the value starting from P and the following integer value.
If you see after2503 the value is single,double,triple and keep on getting incremented.
Kindly suggest.
Thanks
Hey @avinashy
try this regex pattern
System.Text.RegularExpressions.Regex.Match(yourString, “P-\d+(?= :)”).Value
If you’re working with a whole DataTable, you can use a For Each Row loop and apply this to each row’s specific column:
extractedValue = Regex.Match(row(“YourColumnName”).ToString, “P-\d+(?= :)”).Value