So I have the below method that will scan through a list of words, finds "Control Number:" and sets it to wordNumber, then it sets the next word to controlNum (which is the string I am looking to return).
public string ABSFindControlNumber(List<tessnet2.Word> wordList)
{
for (int i = 0; i < wordList.Count; i++)
{
if (wordList[i].Text == "Control Number:" && wordList[i].Confidence >= 50)
{
string wordNumber = wordList[i].Text.ToString();
controlNum = wordList[i + 1].Text.ToString();
return controlNum;
}
}
}
But after finding out how to do with a similar approach using RegEx. I want to see if there is a way to set controlNum to the next word. I have a few different cases for certain letters/numbers just in case it doesn't find the exact word.
if (Regex.IsMatch(text, @"c(0|o)ntr(0|o)(l|1|i)\s+nu(in|m)ber(:|;|s)", RegexOptions.IgnoreCase))
{
controlNum = ???
}