in aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/entities/SearchPattern.java [106:135]
private static boolean simpleWildcardMatch(String pattern, String text) {
int j = 0;
int patternLength = pattern.length();
int textLength = text.length();
for (int i = 0; i < patternLength; i++) {
char p = pattern.charAt(i);
if (p == '*') {
// Presumption for this method is that globs only occur at end
return true;
} else if (p == '?') {
if (j == textLength) {
return false; // No character to match
}
j++;
} else {
if (j >= textLength) {
return false;
}
char t = text.charAt(j);
if (p != t) {
return false;
}
j++;
}
}
// Ate up all the pattern and didn't end at a glob, so a match will have consumed all
// the text
return j == textLength;
}