System.Text.RegularExpressions.Regex.Match(QuoteTxt,String.Join("|",arrStr|"\d+\d{1,3}")).Value
or
System.Text.RegularExpressions.Regex.Match(QuoteTxt,String.Join("|",arrStr) and "\d+\d{1,3}")).Value
I am trying to do a Regex match for the array contents plus the digits expression.
If there is another way to do it, perhaps with filtering datatable, I am open to all options.
So, This is a regex match done via the expression " ^.* ", to grab it line by line.
Now, I want to do a regex match for the city names circled in red, and all of the pricing detail (example circled in blue), whiie keeping the line by line format (so I can put into a datatable - which I have already accomplished successfully via a while loop and a counter variable)
So, I know, in order to use multiple regex expressions, you can use the “|” operator between each expression, but in this case, I am trying to use the String.Join(“|”, array) results (which are the city names) PLUS the regex for the pricing.
Was also thinking about saving the intital regex capture (the screenshot above) to a datetable, and then filtering that datatable to keep rows that contain the contents of an array (city names) and the regex for the pricing information. If you have a LINQ/VB.Net script to tackle it that way, I would be open to that as well.
I have seen this code on the forum for filtering datatable based on contents in an array:
(From r in yourDataTableVar.AsEnumerable
Where yourFilterTokenArrayVar.Any(Function (x) r(“columnName”).toString.Contains(x))
Select r).CopyToDataTable
But how could I also add in the regex expression for the pricing as well?
(From r In yourDataTableVar.AsEnumerable
Where yourFilterTokenArrayVar.Any(Function (x) System.Text.RegularExpressions.Regex.IsMatch(r("columnName").ToString,x))
Select r).CopyToDataTable
OR
(From r In yourDataTableVar.AsEnumerable
Where System.Text.RegularExpressions.Regex.IsMatch(r("columnName").ToString,String.Join("|",yourFilterTokenArrayVar))
Select r).CopyToDataTable
note : yourFilterTokenArrayVar ={“Califorinia”,“Nevada”,“\d+”} for example.