I tried to implement wildcards search in my application using some algorithms (k-gram algorithm etc.), but it was very complex.
Until i found this code, and it works perfectly .. but i don't know how it get check and get results !
Code:
public static boolean wildCardMatch(String text, String pattern)
{
return text.matches( pattern.replace("?", ".?").replace("*", ".*?") );
}
Does their anyone help me to knows how it work ? what's the idea of replace function?