code: public RewriteResult match(String path) {
  
          for (CmsRewriteAlias alias : m_aliases) {
              try {
                  Pattern pattern = Pattern.compile(alias.getPatternString());
                  Matcher matcher = pattern.matcher(path);
                  if (matcher.matches()) {
                      String newPath = matcher.replaceFirst(alias.getReplacementString());
                      return new RewriteResult(newPath, alias);
                  }
              } catch (PatternSyntaxException e) {
                  LOG.warn(e.getLocalizedMessage(), e);
              } catch (IndexOutOfBoundsException e) {
                  LOG.warn(e.getLocalizedMessage(), e);
              }
          }
          return null;
      }
docs: Tries to rewrite a given path, and either returns the rewrite result or null if no
  rewrite alias matched the path.<p>
  
  @param path the path to match
  @return the rewrite result or null if no rewrite alias matched