/ Apr 21st, 2021 /

0.13 Upgrade Guide

An upgrade guide that addresses breaking changes in 0.13.0

0.13 includes one minor breaking change:

  1. parse_regex in VRL no longer returns numeric capture groups by default.

We cover each below to help you upgrade quickly:

Upgrade Guide

Breaking: parse_regex in VRL no longer returns numeric capture groups by default.

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" }

This change was made available in 0.13.0. You can get this change by downloading the latest stable release.

Like What You See?