Skip to content

Interpolation when key contain special character (e.g., space) #2817

Description

@aubertc

Describe the bug

I expect the command

yq '"Test: \( .["First name"])"' data.yaml

to be correctly parsed as a string interpolation looking at displaying the value corresponding to the key First name.

Version of yq: yq (https://github.com/mikefarah/yq/) version v4.53.3
Operating system: Debian
Installed via: binary release

Input Yaml

data.yml:

value: things
First name: Bill

Command
The command you ran:

yq '"Test: \( .["First name"])"' data.yaml

Actual behaviour

Error: 1:14: lexer: invalid input text "First name\"])\""

Note that

yq '"Test: \( .value)"' data.yaml

works as expected by returning

Test: things

Expected behaviour

Test: Bill

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions