i dont know exactly about the greedy issue, but try this if it works for you:
public boolean like(final String str, String expr)
{
final String[] parts = expr.split("%");
final boolean traillingOp = expr.endsWith("%");
expr = "";
for (int i = 0, l = parts.length; i < l; ++i)
{
final String[] p = parts[i].split("\\\\\\?");
if (p.length > 1)
{
for (int y = 0, l2 = p.length; y < l2; ++y)
{
expr += p[y];
if (i + 1 < l2) expr += ".";
}
}
else
{
expr += parts[i];
}
if (i + 1 < l) expr += "%";
}
if (traillingOp) expr += "%";
expr = expr.replace("?", ".");
expr = expr.replace("%", ".*");
return str.matches(expr);
}