nit: I think you can use pattern.contains() for the "*" case and pattern.startsWith() for the "!" case?