Consider the following line method<arg1,arg2,arg3>
I would like to use RegEx to get the parts of method , arg1 , arg2 , arg3 from this line.
The following regex /([a-z0-9]+)<(?:([a-z0-9]+),?)*>/i corresponds to the entire string.
I.e
var result = /([a-z0-9]+)<(?:([a-z0-9]+),?)*>/i.test('method<arg1,arg2,arg3>');
But the regEx.exec method returns only parts of method , arg3 .
result = /([a-z0-9]+)<(?:([a-z0-9]+),?)*>/i.exec('method<arg1,arg2,arg3>'); // result is ["methodname<arg1,arg2,arg3>", "methodname", "arg3"] // as opposed to // ["methodname<arg1,arg2,arg3>", "methodname", "arg1", "arg2", "arg3"]
Is there a way to get all group matches?
Note: I am asking for this for training purposes and I do not want to work with JavaScript.
Edit: The number of arguments (arg1, arg2, etc.) is arbitrary and can vary in different cases.