diff --git a/pkg/yqlib/operator_assign_test.go b/pkg/yqlib/operator_assign_test.go index 67eacc74..d548b865 100644 --- a/pkg/yqlib/operator_assign_test.go +++ b/pkg/yqlib/operator_assign_test.go @@ -12,6 +12,13 @@ var assignOperatorScenarios = []expressionScenario{ "D0, P[], ()::a:\n b: cat\nx: frog\n", }, }, + { + description: "Create yaml file with value with spaces", + expression: `.a.b = "cat" | .x = "frog jumps"`, + expected: []string{ + "D0, P[], ()::a:\n b: cat\nx: frog jumps\n", + }, + }, { description: "Update node to be the child value", document: `{a: {b: {g: foof}}}`, diff --git a/pkg/yqlib/path_tokeniser.go b/pkg/yqlib/path_tokeniser.go index bcb7cc02..59cfe476 100644 --- a/pkg/yqlib/path_tokeniser.go +++ b/pkg/yqlib/path_tokeniser.go @@ -250,7 +250,7 @@ func initLexer() (*lex.Lexer, error) { lexer.Add([]byte(`[Nn][Uu][Ll][Ll]`), nullValue()) lexer.Add([]byte(`~`), nullValue()) - lexer.Add([]byte(`"[^ "]*"`), stringValue(true)) + lexer.Add([]byte(`"[^"]*"`), stringValue(true)) lexer.Add([]byte(`\[\]`), literalToken(SplatOrEmptyCollect, true))