/* matchstar: search for c*re at beginning of text */
int matchstar(int c, char *re, char *text)
{
   do {  /* a * matches zero or more instances */
      if (matchhere(re, text))
         return 1;
   } while (*text!='\0' && (*text++==c || c=='.'));
   return 0;
}

Example 3: The function matchstar is called when the expression begins with a starred character.

Back to Article
Copyright © 1999, Dr. Dobb's Journal