I’m having difficulty with a scenario, hoping you could help!
I have a list of strings which are acceptable eg: This Is A String 1 , This Is A String 2, This Is A String 3.
And I am comparing a string I have found and if it’s on this list I want to ignore and move on.
My issue is that the use case also wants wildcards in this list of acceptable string and then I want to compare my string against these also
eg: This Is A String 1, This Is A String 2, * Is A String *.
So for example if the string I am comparing to this list is That Is A String 4, I want this to match also. Basically i want to search this list for exact matches (which I have done already) but now I also want to account for these wildcards of acceptable markets too.
If the String that you are comparing contains just Is A String is that valid or does it need to have some words/characters at the beginning and at the end also.
Hey Man So that will be a string in the list and it will have words either side of this, so if the string I am comparing to this is for example “Team A Is A String Team B”, so as this has “Is A String” in it, I would like to ignore this.
Thanks man, I have tried this, yes, but my solution has many different versions of this in a list of strings so am hoping to build out a regex or find a better way of comparing to the list without individually specifying each one if that makes sense.
@Kyleb91 ,
Maybe we can separate the two lists, one containing the strings which should be a exact match, the other list containing the wildcard match.
exactMatchList.Any(Function(x)x.Equals(yourStringToCompare)) //Returns True if exact string is present in the list
wildCardsList.Any(Function(x)System.Text.RegularExpressions.Regex.IsMatch(yourStringToCompare,x)) //Returns True if it matches any one of the values in wild card list
Considering wildCardList is a Array of String variable, which contains values already containing the wildcards/regex expression
Thanks man this is great, getting there… although I am unsure if this is testing accurately for me the wildcardList expression. So in this I need to use the string from the list with it’s included wildcard to see if my string matches. I have tested this but the output is still showing a correct match even if i delete this from the list. I will spin up a xaml for clarity