Help me with regular expression to filter excel based on the words present on 1st column/.
I have to keep the rows if the row(0) contains/ equals - e.g. India, Europe, Shri Lanka, China, Nepal, nepal, europe, Shri lanka etc, there are 20 such words approx. and other alphanumeric words which might vary.
My question is - shall I simply put -all like below
e…g. dt.AsEnumerble.Where(Funcion(a)System.Text.RegularExpressions.Regex.IsMatch(a(0).ToString, “\b[India|india]\w+|\b[europe|Europe]\w+”)).CopyToDatatable
Please help me to build more accurate expression. as approx 20words are there to mention.
The requirement was to check specific words like you have mentioned a defined list of approx 20.
But what you have used is more generic and it could match any words and not specific to the words in the defined list.
So we would ask you to analyse again and let us know what is actually required to be performed.
On the other hand, if a Concatenated Condition was required then after the regex match we could check if the value matched is within the defined list like below :
Thanks for your reply, actually you helped me earlier with the mentioned expression and I tried to add in same, but since words are 20 I thought to check here. I can keep the words in array. tried adding array but not working. Those words can be caps , small letters too but yes I will have the word list in advance which I can add in array.
Hi @ppr , Yes it’s working However; I have to combine it with few more conditions.
I have attached in sample.xlsx above.It will be great help if we could add all conditions in 1 expression.