diff --git a/crates/nu-command/src/strings/split/words.rs b/crates/nu-command/src/strings/split/words.rs index 6cb5562a70..b95a06f65c 100644 --- a/crates/nu-command/src/strings/split/words.rs +++ b/crates/nu-command/src/strings/split/words.rs @@ -187,7 +187,7 @@ fn split_words_helper(v: &Value, word_length: Option, span: Span, graphem // [^[:alpha:]\'] = do not match any uppercase or lowercase letters or apostrophes // [^\p{L}\'] = do not match any unicode uppercase or lowercase letters or apostrophes // Let's go with the unicode one in hopes that it works on more than just ascii characters - let regex_replace = Regex::new(r"[^\p{L}\']").expect("regular expression error"); + let regex_replace = Regex::new(r"[^\p{L}\p{N}\']").expect("regular expression error"); let v_span = v.span(); match v { @@ -422,4 +422,9 @@ mod test { test_examples(SubCommand {}) } + #[test] + fn mixed_letter_number() { + let actual = nu!(r#"echo "a1 b2 c3" | split words | str join ','"#); + assert_eq!(actual.out, "a1,b2,c3"); + } }