code: function (m, input) {
          var pattern = mhchemParser.patterns.patterns[m];
          if (pattern === undefined) {
            throw ["MhchemBugP", "mhchem bug P. Please report. (" + m + ")"];  // Trying to use non-existing pattern
          } else if (typeof pattern === "function") {
            return mhchemParser.patterns.patterns[m](input);  // cannot use cached var pattern here, because some pattern functions need this===mhchemParser
          } else {  // RegExp
            var match = input.match(pattern);
            if (match) {
              var mm;
              if (match[2]) {
                mm = [ match[1], match[2] ];
              } else if (match[1]) {
                mm = match[1];
              } else {
                mm = match[0];
              }
              return { match_: mm, remainder: input.substr(match[0].length) };
            }
            return null;
          }
        }
docs: Matching function e.g. match("a", input) will look for the regexp called "a" and see if it matches returns null or {match_:"a", remainder:"bc"}