# Use of "|" in a variable

**URL:** <https://forum.ansible.com/t/use-of-in-a-variable/18871>\
**Category:** Ansible Project\
**Created:** [July 28, 2015, 12:47am UTC](https://forum.ansible.com/t/use-of-in-a-variable/18871 "2015-07-28T00:47:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smalenfant](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/smalenfant/32/2389_2.png) [@smalenfant](https://forum.ansible.com/u/smalenfant)\
**Post date:** [July 28, 2015, 12:47am UTC](https://forum.ansible.com/t/use-of-in-a-variable/18871/1 "2015-07-28T00:47:10Z")

</div>

I’m running into a little problem trying to register a variable with a “|” in it. Anybody know how to escape those?

I’ve got this template :

{% for sections in transforms\_conf %}

[{{ sections.section }}]

{% for options in sections.options %}

{% for option, value in options.iteritems() %}

{{ option }} = {{ value }}

{% endfor %}

{% endfor %}

{% endfor %}

With the following variables :

transforms\_conf:

- section: setnull

options:

- REGEX: “\b/exclude1/\b|\b/exclude2/\b”

- DEST\_KEY: queue

- FORMAT: nullQueue

Which I’m trying to get this as output :

[setnull]

REGEX = \b/exclude1/\b|\b/exclude2/\b

DEST\_KEY = queue

FORMAT = nullQueue

Although I only get this in the results :

[setnull]

REGEX = \b/exclude1/\b

DEST\_KEY = queue

FORMAT = nullQueue

Thanks

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [July 28, 2015, 4:04pm UTC](https://forum.ansible.com/t/use-of-in-a-variable/18871/2 "2015-07-28T16:04:39Z")

</div>

I'm not able to replicate this:

---

<div class="post-metadata">

**Author:** ![R\_Dikkes](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@R\_Dikkes](https://forum.ansible.com/u/R_Dikkes)\
**Post date:** [August 5, 2015, 1:14pm UTC](https://forum.ansible.com/t/use-of-in-a-variable/18871/3 "2015-08-05T13:14:58Z")

</div>

Tried to escape it?

- REGEX: “\b/exclude1/\b|\b/exclude2/\b”
