I have been writing a recursive wildcard matching algorithm in c++. But I'm having trouble completing it. Here look at what I write so far.
?
matches any character, *
matches any string
bool WildCardMatch(char *str, char *match){
while (*match){
if (*match =='?'){
if (!*str){
return false;
}
str++;
match++;
}
else if (*match == '*'){
if (WildcardMatch(str, match + 1)){
return true;
}
return false;
}
}
return !*str && !*match;
}
What's wrong with my algorithm? How should I fix it? Or can anyone suggest me a better solution for recursive wildcard matching algorithm?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4