Q:

discordjs/nodejs , How can i check if a message only contains custom emotes?

I'm building my own discordbot in NodeJS by using discordjs.
With the code below you can recognize if the message contains only a emote
client.on("message", function(message){
var bool = message.content.match(/^(:[^:\s]+:|<:[^:\s]+:[0-9]+>|<a:[^:\s]+:[0-9]+>)$/);

an emote shows like this when you do an console.log (the emote Kappa as an example) :

<:Kappa:731053321502326797>

Now it only matches when 1 emote is in the message
But it doesnt match if a message contains 2 emotes with a space between it.
How can i make this possible?

A:

Use
^(:[^:\s]+:|<:[^:\s]+:[0-9]+>|<a:[^:\s]+:[0-9]+>)+$

See proof.
Explanation:
NODE                     EXPLANATION
--------------------------------------------------------------------------------
  ^                        the beginning of the string
--------------------------------------------------------------------------------
  (                        group and capture to \1 (1 or more times
                           (matching the most amount possible)):
--------------------------------------------------------------------------------
    :                        ':'
--------------------------------------------------------------------------------
    [^:\s]+                  any character except: ':', whitespace
                             (\n, \r, \t, \f, and " ") (1 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
    :                        ':'
--------------------------------------------------------------------------------
   |                        OR
--------------------------------------------------------------------------------
    <:                       '<:'
--------------------------------------------------------------------------------
    [^:\s]+                  any character except: ':', whitespace
                             (\n, \r, \t, \f, and " ") (1 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
    :                        ':'
--------------------------------------------------------------------------------
    [0-9]+                   any character of: '0' to '9' (1 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
    >                        '>'
--------------------------------------------------------------------------------
   |                        OR
--------------------------------------------------------------------------------
    <a:                      '<a:'
--------------------------------------------------------------------------------
    [^:\s]+                  any character except: ':', whitespace
                             (\n, \r, \t, \f, and " ") (1 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
    :                        ':'
--------------------------------------------------------------------------------
    [0-9]+                   any character of: '0' to '9' (1 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
    >                        '>'
--------------------------------------------------------------------------------
  )+                       end of \1 (NOTE: because you are using a
                           quantifier on this capture, only the LAST
                           repetition of the captured pattern will be
                           stored in \1)
--------------------------------------------------------------------------------
  $                        before an optional \n, and the end of the
                           string

