Search string in datatable using wildcards


Dear all,

I’m struggeling with this topic:

I have a list (using for each to iterate through it), with strings (e.g. “OK_riskprofile_2907_Ledger_20180601_tm_20180630.xlsx”, “production_care_make__2018_05-07-2018.xlsx” ). Now it needs to match a value in a datatable. So within the for each I have a for each row. Now the hard part is, the row(0).tostring gives values such as:


So I am searching for a method to use wildcards such as:


Does anyone have an idea? Can i use ismatch or regex? Or do I need split and then iterate? How can I make that variable?



Why don’t you use .Contains method?
it help you check whether a part of string is present in a particular string or not!
I maybe not correct, but this might solve your problem!


Yeah, you can use a Regex pattern.

System.Text.RegularExpressions.Regex.Match(row(0).ToString, "OK_riskprofile(.*)Ledger(.*)\.xlsx”).Success

Or something like that.
.Success will return True or False. You can probably use the IsMatch activity also with a pattern.



Thanks for the suggestion, however the strings have comparable number of characters and within this string, the characters differ. So unfortunately contains does not work.


Thanks that worked! I even used the string with wildcards as a variable:

   variable = regex.replace(item, "[0-9]", "(.*)")

    regex.ismatch(row(0).tostring, variable)

Thanks for your suggestion!!