| 39 | |
| 40 | # The first string may contain wildcards |
| 41 | def _match(first, second): |
| 42 | |
| 43 | # If we reach end of both strings, we are done |
| 44 | if len(first) == 0 and len(second) == 0: |
| 45 | return True |
| 46 | |
| 47 | # Make sure that the characters after '*' are present |
| 48 | # in second string. Can't contain two consecutive '*' |
| 49 | if len(first) > 1 and first[0] == '*' and len(second) == 0: |
| 50 | return False |
| 51 | |
| 52 | if (len(first) > 1 and first[0] == '?') or (len(first) != 0 |
| 53 | and len(second) !=0 and first[0] == second[0]): |
| 54 | return _match(first[1:],second[1:]) |
| 55 | |
| 56 | if first[:1] == '*': |
| 57 | return _match(first[1:],second) or _match(first,second[1:]) |
| 58 | |
| 59 | return False |
| 60 | |
| 61 | def calcWildCardLen(wldCLen,recursiveFail): |
| 62 | wldCLen += 1 |