Multiple regex within begin/endCaptures


#1

I have problem with regex matches on the same level. Currently comma sign is only checked in one match, so possible results depends on patterns order:

  • number first (first comma is not matched):
  • comma first (second number is not matched):
'inner_numbers':
        'patterns':[
            {
                'captures':
                    '2':
                        'name': 'constant.numeric.inner.jbase'
                'match': '((?:\\G)|(?:[^.\\w]))(([1-9]+[0-9]*|0)([.][0-9]+)*)(?![.\\w]+)'
            }
        ]
    'dynamic_array':
        'patterns':[
            {
                'comment': 'DYNAMIC array'
                'captures':
                    '1':
                        'name': 'punctuation.definition.dynamic_array.jbase'
                    '2':
                        'patterns': [
                            {
                              'begin': '<'
                              'beginCaptures':
                                  '0':
                                    'name': 'punctuation.definition.string.dynamic_array.opening_bracket.jbase'
                              'end': '>'
                              'endCaptures':
                                  '0':
                                    'name': 'punctuation.definition.string.dynamic_array.closing_bracket.jbase'
                              'patterns': [
                                {
                                    'name': 'punctuation.definition.string.dynamic_array.comma.jbase'
                                    'match': ','
                                },
                                {
                                    'include': '#inner_numbers'
                                }
                              ]
                            }
                        ]
                'match': '([\\w.]+(<[\\w. -+]+(,[\\w. -+]+)*>))'
            }
        ]

My goal is to colour both comma sign and number avoiding this effect: