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.
Try
String s= "A IU somehting PRI something RET whatever"; Pattern p= Pattern.compile("(IU|PRI|RET)"); Matcher m= p.matcher(s); while (m.find()) { String matched= m.group(1); System.out.println(matched); }
It prints:
IU PRI RET