code: function strategyForRegEx(regex) {
        // Ensure the 'global' flag is set.
        if (regex instanceof RegExp) {
          regex = regex.source;
        }
        regex = new RegExp(regex, "g");
  
        return function(contentBlock, callback) {
          var text = contentBlock.getText();
          var matchArr = null;
          while ((matchArr = regex.exec(text)) !== null) {
            var start = matchArr.index;
            callback(start, start + matchArr[0].length);
          }
        };
      }
docs: Given a regex, returns a corresponding 'strategy' for CompositeDecorator: a function that calls its callback for all matches of the regex in a block's content.