I want to validate a String and, after that, get all the matches from some groups.

RegEx:

```
/^<[A-Za-z0-9]>::=(<[A-Za-z0-9]>)+(\|(<[A-Za-z0-9]>)+)+$/

```

So, if I get something like `<A>::=<B><A>|<Y><A>|<Z>` is valid, but if I get something like `<A>::=<B>|` is false.

There's no problem with the validation, the problem is that I want to take the text inside `<` and `>` because I need it later.

So, if I get `<exparit>::=<number>|<number><exparit>`, then I want to get `["exparit", "number", "number", "exparit"]`

My code looks like

```
Rules = {
  "BNF" : /^<[A-Za-z0-9]>::=(<[A-Za-z0-9]>)+(\|(<[A-Za-z0-9]>)+)+$/
};

var checkBNF = function ( bnf ) {
  if ( Rules.BNF.test( bnf ) ) {
    console.log('ok');
    //How to get the text inside < and > ??
  }
  else {
    console.log('no');
  }
};

```

I really appreciate any kind of help, such a book, link, example or the resolution of this problem.

Thanks!