I have a Text box and the user can enter names like "*smith"
Where "john smith" and "thesmith" would qualify.
The regex is simple. But,does anybody have suggestions on how to interpret that into regex? are there any samples on the internet?
I searched and could not find any.
Nick
You can replace the "*" with ".*", prepend with "^" and append "$":
string regex = "^" + textBox.Replace("*",".*") + "$";
To check for a match, use:
if (Regex.IsMatch(inputString, regex))
...