I'm writing a recursive method that checks each letter of the string to compare them. I'm having trouble making the "*" character match with any, and act as as many letters as needed. (Making it a wildcard)
I was wondering if someone can give me a hint on the algorithm that would be used?
Here is what I have so far.
public static boolean match(String x, String y) {
    return match_loop(x, y, 0, 1);
}
public static boolean match_loop(String a, String b, int i, int s) {
    try {
        if (a == b) {
            return true;
        }
        if (i >= a.length() && i >= b.length()) {
            return true;
        }
        if (a.charAt(i) == b.charAt(i)) {
            return match_loop(a, b, i + 1, s);
        }
        //(((...A bunch of if statements for my other recursion requirements
        return false;
    } catch (java.lang.StringIndexOutOfBoundsException e) {
        return false;
    }
}
public static void main(String[] args) {
    System.out.println(match("test", "t*t")); // should return true
}
What I was thinking of doing is adding another arguement to the method, an int that will act as a letter backcounter. Basically I'm thinking of this if a or b at char(i-s) (s originally being 1.) is a *, recall the recursion with s+1. and then a few more different ifs statements to fix the bugs. However this method seems really long and repetitive. Are there any other algorithms I can use?
 
     
     
     
     
    