I need to perform Wildcard (*
, ?
, etc.) search on a string.This is what I have done:
string input = "Message";string pattern = "d*";Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);if (regex.IsMatch(input)){ MessageBox.Show("Found");}else{ MessageBox.Show("Not Found");}
With the above code "Found" block is hitting but actually it should not!
If my pattern is "e*" then only "Found" should hit.
My understanding or requirement is d* search should find the text containing "d" followed by any characters.
Should I change my pattern as "d.*" and "e.*"? Is there any support in .NET for Wild Card which internally does it while using Regex class?