1

I have a big array of strings (characters a-z, A-Z and digits 0-9). I also have an input string, but few characters are missing (Example: /np/tSt/ing/), '/' represents missing character. I have to find every string from my array who can be formed from input string by replacing '/' with any character (Example: inputString1, AnpAtStAngA, 1np2tSt3ing4...). Is there any non brute-force solution for this problem?

1 Answers1

4

You can use regular expressions for this. Something like .np.tSt.ing.

public static Regex regex = new Regex(".np.tSt.ing.", RegexOptions.CultureInvariant | RegexOptions.Compiled);

...

bool IsMatch = regex.IsMatch(InputText);
dlxeon
  • 1,932
  • 1
  • 11
  • 14