public override int Match(string textToMatch, int matchAtIndex)
{
bool start = true;
int currentIndex = matchAtIndex;
do
{
char currentChar = textToMatch[currentIndex];
if (start && IsValidStartChar(currentChar))
{
start = false;
}
else if (start && IsWildcard(currentChar))
{
currentIndex++;
break;
}
else if (!start && IsSeparator(currentChar))
{
start = true;
}
else if (!start && IsValidChar(currentChar)) {}
else
{
break;
}
currentIndex++;
} while (currentIndex < textToMatch.Length);
if (textToMatch.Substring(matchAtIndex, currentIndex - matchAtIndex) == "*")
return 0;
return currentIndex - matchAtIndex;
}