Tuesday, January 7, 2014

This post is about one of the interview questions and is a coding problem :
bool IsMatch(string input, string pattern);
string input can be "ABCDBDXYZ"
string pattern can be "A*B?D*Z"
* and ? are the usual wild card for 0 or more and only one char respectively.
Here are some possible implementation:
bool IsMatch(string input, string pattern)
{
return Regex.Matches(input, pattern).Count > 0;
}

No comments:

Post a Comment