title: How can I use regex to get command and arguments from a discord message with the (optional) user at the end
body: <p>I'm building a bot that will take commands through Discord Channels like "!COMMAND Some Thing With Spaces In The Name &lt;@123412341234>"</p>
  
  <p>I need a regex expression that, while using javascript, will allow me to get the following:</p>
  
  <pre><code>const args = ["COMMAND", "Some Thing With Spaces In The Name", "&lt;@123412341234&gt;"];
  </code></pre>
  
  <p>OR, in the absence of the user mention at the end:</p>
  
  <pre><code>const args = ["COMMAND", "Some Thing With Spaces In The Name"];
  </code></pre>
  
  <p>I've tried using <code>(\S+)\s(.+)(\s&lt;@\d+&gt;)?</code> but what I get looks like:</p>
  
  <pre><code>const args = ["COMMAND", "Some Thing With Spaces In The Name &lt;@123412341234&gt;"];
  </code></pre>
  
  <p>I need the mention separate. What I'm most interested in is the COMMAND and the argument after it without the mention. Which could be in the command or not. I know I can get the mention by doing <code>message.mentions.users.first()</code>. That's not really what I'm after.</p>
  
  <p>Any help would be greatly appreciated. Thank you.</p>