You can use:
Pattern p = Pattern.compile("/\\*\\*.*?(?:text1|text2).*?\\*\\*/", Pattern.DOTALL);
Pattern.DOTALL
is required to make sure to match text spanning multiple lines*
needs to be escaped using\\*
(?:text1|text2)
is a non capturing alternation, needed to matchtext1
ortext2
.