code: public static Pattern matchesOrContains(String expectedMessage) {
          Pattern pattern;
          if (expectedMessage.startsWith("regex:")) {
              String regex = expectedMessage.substring(expectedMessage.indexOf("regex:") + 6, expectedMessage.length());
              pattern = Pattern.compile(regex);
          } else {
              pattern = Pattern.compile(Pattern.quote(expectedMessage));
          }
          return pattern;
      }
docs: Checks if a given string matches a regular expression or contains a string
  
  @param expectedMessage message used for comparing
  @return boolean