I have 3 values IU, PRI and RET. if my input string contains any one or more value(s), the Java regular expression should return true.
You could do this in one line and get your boolean value.
boolean matcher = Pattern.matches("[UI]{2}|[PRI]{3}|[RET]{3}", stringToBeMatched);