code: public static String stringMatcherByPattern(String input, String patternStr) {
  
          String output = PcConstants.SYSTEM_FAIL_MATCH_REGEX;
  
          // 20140105: fix the NPE issue
          if (patternStr == null) {
              logger.error("patternStr is NULL! (Expected when the aggregation rule is not defined at "
                      + PcDateUtils.getNowDateTimeStrStandard());
              return output;
          }
  
          if (input == null) {
              logger.error("input (Expected when the response is null and now try to match on response) is NULL in stringMatcherByPattern() at "
                      + PcDateUtils.getNowDateTimeStrStandard());
              return output;
          } else {
              input = input.replace("\n", "").replace("\r", "");
          }
  
          logger.debug("input: " + input);
          logger.debug("patternStr: " + patternStr);
  
          Pattern patternMetric = Pattern.compile(patternStr, Pattern.MULTILINE);
  
          final Matcher matcher = patternMetric.matcher(input);
          if (matcher.matches()) {
              output = matcher.group(1);
          }
          return output;
      }
docs: this remove the linebreak.
  
  @param input
  the input
  @param patternStr
  the pattern str
  @return the string