<p>How can I use Mike Farah's YQ v4 to update a field that has special characters.</p>
<p>e.g. manipulating below:</p>
<pre><code>      containers:
        - name: flyway
          image: xx.dkr.ecr.eu-west-1.amazonaws.com/testimage:60
</code></pre>
<p>Errors for attempts:</p>
<pre><code>$ yq e &quot;.spec.template.spec.containers[0].image=xx.dkr.ecr.eu-west-1.amazonaws.com/testimage:61&quot; flyway.yaml
Error: Bad expression, please check expression syntax

$ yq e &quot;.spec.template.spec.containers[0].image=xx\.dkr\.ecr\.eu-west-1\.amazonaws\.com\/testimage:61&quot; flyway.yaml
Error: Parsing expression: Lexer error: could not match text starting at 1:53 failing at 1:54.
        unmatched text: &quot;\\&quot;

#########

$ echo $image
xx.dkr.ecr.eu-west-1.amazonaws.com/testimage:61
$ yq e &quot;.spec.template.spec.containers[0].image=$image&quot; flyway.yaml
Error: Bad expression, please check expression syntax
</code></pre>
<p>Didnt find any documents explaining any escape characters for special character.</p>

<p>Found this documentation:
<a href="https://mikefarah.gitbook.io/yq/operators/env-variable-operators" rel="nofollow noreferrer">https://mikefarah.gitbook.io/yq/operators/env-variable-operators</a></p>
<p>This worked for me:</p>
<pre><code>$ echo $image
xx.dkr.ecr.eu-west-1.amazonaws.com/testimage:61
$ myenv=$image yq e '.spec.template.spec.containers[0].image=env(myenv)' flyway.yaml
&lt;&lt;removed contents for brevity &gt;&gt;
    spec:
      containers:
        - name: flyway
          image: xx.dkr.ecr.eu-west-1.amazonaws.com/testimage:61
</code></pre>
