From 0eb2b86be00fd808e581bdddc0cf9e6ce0a67d6a Mon Sep 17 00:00:00 2001 From: cmdlineluser <99486669+cmdlineluser@users.noreply.github.com> Date: Mon, 31 Jul 2023 20:24:29 +0100 Subject: [PATCH] Do not return 0th group --- crates/polars-ops/src/chunked_array/strings/namespace.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/polars-ops/src/chunked_array/strings/namespace.rs b/crates/polars-ops/src/chunked_array/strings/namespace.rs index d3c462a59ef4..7e1c9e2b4704 100644 --- a/crates/polars-ops/src/chunked_array/strings/namespace.rs +++ b/crates/polars-ops/src/chunked_array/strings/namespace.rs @@ -361,11 +361,11 @@ pub trait Utf8NameSpaceImpl: AsUtf8 { let n_fields = reg.captures_len(); - let idxs = (0..n_fields).map(|idx| idx.to_string()).collect::>(); + let idxs = (1..n_fields).map(|idx| idx.to_string()).collect::>(); let mut builders = idxs .iter() - .zip(reg.capture_names()) + .zip(reg.capture_names().skip(1)) // skip 0th group .map(|(idx, name)| { let name = match name { Some(name) => name, @@ -385,6 +385,7 @@ pub trait Utf8NameSpaceImpl: AsUtf8 { match caps { Some(caps) => { caps.iter() + .skip(1) // skip 0th group .zip(builders.iter_mut()) .for_each(|(m, builder)| match m { Some(m) => builder.append_value(m.as_str()),