website/content/en/highlights/2021-04-21-0-13-upgrade-guide.md
0.13 includes one minor breaking change:
We cover each below to help you upgrade quickly:
parse_regex in VRL no longer returns numeric capture groups by default.<a name="second"></a>Previously, when the Vector Remap Language (VRL) parse_regex function was used, it would return
both named capture groups as well as numeric capture groups.
For example:
parse_regex!("hello 123 world", r'hello (?P<number>\d+) world')
Would return:
{ "0": "hello 123 world", "1": "123", "number": "123" }
With 0 matching the whole regex, and 1 matching the first capture group, in addition to number.
We heard from users that they did not expect the numeric groups by default so we decided to leave them out by default now.
Using our previous example:
parse_regex!("hello 123 world", r'hello (?P<number>\d+) world')
It now returns:
{ "number": "123" }
A new numeric_groups parameter that can be used to have the numeric capture groups returned like before.
Again using the same example, but with the new parameter:
parse_regex!("hello 123 world", r'hello (?P<number>\d+) world', numeric_groups: true)
This returns the old value of:
{ "0": "hello 123 world", "1": "123", "number": "123" }