message: Add maximum number of matches
diff: @@ -19,6 +19,7 @@ const MSGTYPE_TO_TYPE = {
  };
  const MIN_LENGTH_TO_MATCH = 4;
  +const MAX_MATCHES = 5;
  function MatrixAction(type, text, htmlText, timestamp) {
  if (ACTION_TYPES.indexOf(type) === -1) {
  @@ -37,7 +38,9 @@ MatrixAction.prototype.formatMentions = function(nickUserIdMap) {
  + ")";
  const userRegex = new RegExp(regexString, "igm");
  let match;
  - while ((match = userRegex.exec(this.text)) !== null) {
  + let i = 0;
  + while ((match = userRegex.exec(this.text)) !== null && i < MAX_MATCHES) {
  + i++;
  let matchName = match[1];
  if (matchName.length < MIN_LENGTH_TO_MATCH) {
  continue;
  