diff --git a/crates/nu-command/src/strings/parse.rs b/crates/nu-command/src/strings/parse.rs index c538a35408..07aae3efd8 100644 --- a/crates/nu-command/src/strings/parse.rs +++ b/crates/nu-command/src/strings/parse.rs @@ -74,12 +74,12 @@ impl Command for Parse { result: Some(Value::List { vals: vec![ Value::Record { - cols: vec!["Capture1".to_string(), "Capture2".to_string()], + cols: vec!["capture0".to_string(), "capture1".to_string()], vals: vec![Value::test_string(""), Value::test_string("foo")], span: Span::test_data(), }, Value::Record { - cols: vec!["Capture1".to_string(), "Capture2".to_string()], + cols: vec!["capture0".to_string(), "capture1".to_string()], vals: vec![Value::test_string("bar"), Value::test_string("")], span: Span::test_data(), }, @@ -93,7 +93,7 @@ impl Command for Parse { "\" @another(foo bar) \" | parse -r '\\s*(?<=[() ])(@\\w+)(\\([^)]*\\))?\\s*'", result: Some(Value::List { vals: vec![Value::Record { - cols: vec!["Capture1".to_string(), "Capture2".to_string()], + cols: vec!["capture0".to_string(), "capture1".to_string()], vals: vec![ Value::test_string("@another"), Value::test_string("(foo bar)"), @@ -108,7 +108,7 @@ impl Command for Parse { example: "\"abcd\" | parse -r '^a(bc(?=d)|b)cd$'", result: Some(Value::List { vals: vec![Value::Record { - cols: vec!["Capture1".to_string()], + cols: vec!["capture0".to_string()], vals: vec![Value::test_string("b")], span: Span::test_data(), }], @@ -276,7 +276,7 @@ fn column_names(regex: &Regex) -> Vec { .skip(1) .map(|(i, name)| { name.map(String::from) - .unwrap_or_else(|| format!("Capture{}", i)) + .unwrap_or_else(|| format!("capture{}", i - 1)) }) .collect() } diff --git a/crates/nu-command/tests/commands/parse.rs b/crates/nu-command/tests/commands/parse.rs index 1597f029b3..6998443a27 100644 --- a/crates/nu-command/tests/commands/parse.rs +++ b/crates/nu-command/tests/commands/parse.rs @@ -144,7 +144,7 @@ mod regex { open nushell_git_log_oneline.txt | parse --regex "(\\w+) (.+) \\(#(\\d+)\\)" | get 1 - | get Capture1 + | get capture0 "# )); @@ -163,7 +163,7 @@ mod regex { open nushell_git_log_oneline.txt | parse --regex "(?P\\w+) (.+) \\(#(?P\\d+)\\)" | get 1 - | get Capture2 + | get capture1 "# ));