code: function findPattern(text) {
          var patterns = getPatterns();
  
          for (var i = 0; i < patterns.length; i++) {
            if (text.indexOf(patterns[i].start) !== 0) {
              continue;
            }
  
            if (patterns[i].end && text.lastIndexOf(patterns[i].end) != text.length - patterns[i].end.length) {
              continue;
            }
  
            return patterns[i];
          }
        }
docs: Finds a matching pattern to the specified text