Hello everybody and thanks for all tips and code. After all I wrote my own function that serves my needs. It is capable to handle ? and * correctly - as I think. Here it is: int wcmatch(const char *pPattern, const char *pStr; const char *mystrstr(const char *pPattern, const char *pStr, int *pLen; //similiar to strstr() but: // + the search pattern ends at a '\0' or a '*'. // + '?' matches to every character != '\0' // + Return value is pointer to the first char in pStr // that belongs to the first occurence of pPattern // or NULL if not found. // // Example: mystrstr("a?c*xyz", "123456abcdefg", &len) = "abcdefg" // len==3. const char *mystrstr(const char *pPattern, const char *pStr, int *pLen) { int iMatch; const char *pStart=pStr, *pp, *ps; if (pLen) *pLen = 0; if (!pPattern || !pStr) return FALSE; for (pStart=pStr; *pStart; pStart++) { ps = pStart; pp = pPattern; iMatch = TRUE; while (iMatch) { switch (*pp) { case '*': case '\0': if (pLen) *pLen = ps - pStart; return pStart; break; case '?': if (*ps) { pp++; ps++; } else iMatch = FALSE; break; default: if (*pp == *ps) { pp++; ps++; } else iMatch = FALSE; break; } } } return FALSE; } int wcmatch(const char *pPattern, const char *pStr) { if (!pPattern || !pStr) return FALSE; int iWildcardMode = FALSE, iLen; const char *pStarMatchStart; while (*pPattern && *pStr) { switch (*pPattern) { case '?': pPattern++; pStr++; break; case '*': // Switch to wildcard-mode. Keep this mode until a // character diffrent to '?' and '*' is found. iWildcardMode = TRUE; pPattern++; break; default: if (iWildcardMode) { iWildcardMode = FALSE; if (pStarMatchStart = mystrstr(pPattern, pStr, &iLen)) { pPattern += iLen; pStr = pStarMatchStart + iLen; } else return FALSE; } else { if (*pPattern != *pStr) return FALSE; pPattern++; pStr++; } break; } } if (*pPattern == *pStr) return TRUE; if (*pPattern == '\0') { if (iWildcardMode) return TRUE; // Last char of pattern was '*' else return FALSE; // String has additional non matching chars. No match. } if (*pStr=='\0') { // This is a match, if only '*'s follow while (*pPattern == '*')