title: Get the matches from specific groups
body: <p>I want to validate a String and, after that, get all the matches from some groups.</p>
  
  <p>RegEx:</p>
  
  <pre><code>/^&lt;[A-Za-z0-9]&gt;::=(&lt;[A-Za-z0-9]&gt;)+(\|(&lt;[A-Za-z0-9]&gt;)+)+$/
  </code></pre>
  
  <p>So, if I get something like <code>&lt;A&gt;::=&lt;B&gt;&lt;A&gt;|&lt;Y&gt;&lt;A&gt;|&lt;Z&gt;</code> is valid, but if I get something like <code>&lt;A&gt;::=&lt;B&gt;|</code> is false.</p>
  
  <p>There's no problem with the validation, the problem is that I want to take the text inside <code>&lt;</code> and <code>&gt;</code> because I need it later.</p>
  
  <p>So, if I get <code>&lt;exparit&gt;::=&lt;number&gt;|&lt;number&gt;&lt;exparit&gt;</code>, then I want to get <code>["exparit", "number", "number", "exparit"]</code></p>
  
  <p>My code looks like</p>
  
  <pre><code>Rules = {
    "BNF" : /^&lt;[A-Za-z0-9]&gt;::=(&lt;[A-Za-z0-9]&gt;)+(\|(&lt;[A-Za-z0-9]&gt;)+)+$/
  };
  
  var checkBNF = function ( bnf ) {
    if ( Rules.BNF.test( bnf ) ) {
      console.log('ok');
      //How to get the text inside &lt; and &gt; ??
    }
    else {
      console.log('no');
    }
  };
  </code></pre>
  
  <p>I really appreciate any kind of help, such a book, link, example or the resolution of this problem.</p>
  
  <p>Thanks!</p>